Click here to Skip to main content
15,887,349 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi There

is anyone able to point in the right direction or have snippet of code that can change the size of panel in splitcontainer at runtime. i currently have a split container set to horizonatal orientation with 2 panels. In one of the panels there a button that the users press which changes the height of panel2 so it has disappeared.

im try with the code below but getting error message "The SplitterPanel's height cannot be set explicitly. Set the SplitterDistance on the SplitContainer instead."

 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    SplitContainer2.Panel2.Height = 2

End Sub


Any Help be appericated.

thanks IN advance
Posted

Hi,
try this:
VB
Me.SplitContainer2.SplitterDistance = Me.SplitContainer2.Width - Me.SplitContainer2.SplitterWidth
 
Share this answer
 
Comments
SIFNOk 3-Nov-11 10:12am    
Kinggg! Thank you very much! worked like a dreamm! 5 :D
SIFNOk 3-Nov-11 10:15am    
and how doo u revert it back to it orginal state/size.
Raimis9 3-Nov-11 10:30am    
'to set size 200:

Dim MySize as integer=200
Me.SplitContainer2.SplitterDistance = Me.SplitContainer2.Width - Me.SplitContainer2.SplitterWidth - MySize
SIFNOk 3-Nov-11 15:03pm    
Thanks Raimis! I Apperiate all your help :) i honestly would of had no cluee! Propps
and how doo u revert it back to it orginal state/size
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900