how can i do less coding in treeview....

S

Supra

i already done in vb6. I got error : Additional information: Specified
argument was out of the range of valid values.

Sub PanelVisible(ByVal szPanel As String)
Dim i As Integer, VisiblePanel As New Panel
For i = 0 To 7
If TypeOf VisiblePanel.Controls(i) Is Panel Then ==>
error occurred there
If VisiblePanel.Controls(i).Name = szPanel Then
VisiblePanel.Controls(i).Visible = True

VisiblePanel.Controls(i).Location = New
Point(160, 8)
VisiblePanel.Controls(i).Size = New Size(304, 256)
Else
VisiblePanel.Controls(i).Visible = False
End If
End If
Next
End Sub

how can i do less coding in treeview_afterselect..... i have to typed
true,true, etc ,false all times. i simply wanted to call PanelVisible

Private Sub trvPreference_AfterSelect(ByVal sender As
System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs)
Handles trvPreference.AfterSelect
Dim i As String
i = e.Node.Text
Select Case i
Case "Connect"
Panel1.Visible = True
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Panel5.Visible = False
Panel6.Visible = False
Panel7.Visible = False
Panel8.Visible = False

Case "User Info"
Panel1.Visible = False
Panel2.Visible = False
' Panel3.Visible = False
Panel4.Visible = False
Panel5.Visible = False
Panel6.Visible = False
Panel7.Visible = False
Panel8.Visible = False
With Panel3
.Visible = True
.Location = New Point(160, 8)
.Size = New Size(304, 256)
End With

Case "Identd"
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False
Panel5.Visible = False
Panel6.Visible = False
Panel7.Visible = False
Panel8.Visible = False
With Panel4
.Visible = True
.Location = New Point(160, 8)
.Size = New Size(304, 256)
End With

Case "Firewall"
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Panel6.Visible = False
Panel7.Visible = False
Panel8.Visible = False
With Panel5
.Location = New Point(168, 8)
.Size = New Size(304, 256)
.Visible = True
End With

Case "DCC"
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Panel5.Visible = False
Panel7.Visible = False
Panel8.Visible = False
With Panel6
.Location = New Point(168, 8)
.Size = New Size(288, 304)
.Visible = True
End With

Case "DNS"
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Panel5.Visible = False
Panel6.Visible = False
Panel8.Visible = False
With Panel7
.Location = New Point(168, 8)
.Size = New Size(288, 304)
.Visible = True
End With

Case "Misc"
Panel1.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Panel5.Visible = False
Panel6.Visible = False
Panel7.Visible = False
Panel8.Visible = False
With Panel2
.Visible = True
.Location = New Point(160, 8)
.Size = New Size(304, 256)
End With

Case "Colours"
' Panel1.Visible = False
' Panel2.Visible = False
' Panel3.Visible = False
' Panel4.Visible = False
' Panel5.Visible = False
' Panel6.Visible = False
' Panel7.Visible = False
'With Panel8
' .Visible = True
'.Location = New Point(160, 8)
'.Size = New Size(304, 268)
'End With

Dim c As String
c = "Colours" 'Panel8.Name
PanelsVisible(c)
End Select
End Sub

this is similar to mirc chat.
ne ideas u can hint me?
regards,
 
C

Cor Ligthert

Supra,

I answered this exact question (and me not alone) in the dotnet.general
group, did the answer not fit there and than why not? Some feed back in
these newsgroups is needed, purpose is that we all learn from it.

Cor
 
S

Supra

mike doherty solved it for me :)

Cor said:
Supra,

I answered this exact question (and me not alone) in the dotnet.general
group, did the answer not fit there and than why not? Some feed back in
these newsgroups is needed, purpose is that we all learn from it.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top