Im trying to add nodes to a treeview based on letters of the alphabet using :
when I compile I get the folowing error :
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from string "A" to type 'Integer' is not valid.
From what I understand about strings the code is right - But it still won't accept it.
Any ideas? Or could someone please point me in the right direction?
Thanx in advance
Visual Basic:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim node_letter As String
trvClients.Nodes.Clear()
'Set document type
trvClients.Nodes.Add("Phonebook")
'set documents
trvClients.SelectedNode = trvClients.Nodes.Item(0)
trvClients.ExpandAll()
trvClients.ShowLines = True
trvClients.ShowPlusMinus = True
For i = 1 To 26
node_letter = Chr(64 + i)
trvClients.SelectedNode.Nodes.RemoveAt(node_letter)
Next
End Sub
when I compile I get the folowing error :
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from string "A" to type 'Integer' is not valid.
From what I understand about strings the code is right - But it still won't accept it.
Any ideas? Or could someone please point me in the right direction?
Thanx in advance