Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help about panels

Status
Not open for further replies.

afybim

Technical User
Nov 13, 2002
16
TR
hello,
i want to use panel's "show" and "hide" properties in a loop.
for example;

public sub panel_goster(x as integer,y as integer)
dim i as integer
panelx.show
do until (i = y)
if i <> x then
paneli.hide
end if
i=i+1
loop
end sub

but this sub didn't work.
How can i say panelx.show (x=1,2,3,...) in a loop structure..
Thanks..
 
You need to set the Width property of the Panel to 0 to hide it.

StatusBar1.Panels(0).Width = 0

Make sure MinWidth property of the Panel you are hiding is set to 0 and AutoSize property to None.

Example: The following code hides the first Panel in the StatusBar when a form loads.

Private Sub onFormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
StatusBar1.Panels(0).MinWidth = 0
StatusBar1.Panels(0).AutoSize = StatusBarPanelAutoSize.None
StatusBar1.Panels(0).Width = 0
End Sub
 
I think you are talking about the panel container, rather than a status bar panel. The following code will hide all panels in the form with the exception of the specified panel number (assuming all panels are named 'Panelx' where 'x' is a number.

Public Sub panel_goster(ByVal x As Integer)

Dim ct As Control

For Each ct In Me.Controls

If TypeOf ct Is Panel Then

If Convert.ToInt32(ct.Name.Remove(0, 5)) = x Then

ct.Show()

Else

ct.Hide()

End If

End If

Next

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top