L
Luqman
I am trying to fill the treeview in VB.Net 2005 with Hashtable with the
following code.
my field(0)=emp id
my filed(1)=emp name
my field(2)=manager id
Dim MyNodes As New Hashtable()
Dim node As New TreeNode
Dim dsRow as Datarow
For Each dsRow In ds1.Tables(0).Rows
If IsDBNull(dsRow("MgrID")) Then
Me.TreeView1.Nodes.Add(dsRow("EmpName"))
mynodes.add(dsrow("EmpID"),dsrow("EmpName"))
Else
DirectCast(MyNodes(dsRow("Mgr")), TreeNode).Add(dsRow("Ename")) <-------
this line giving error
End If
Next
Please advise what am I missing ?
Best Regards,
Luqman
following code.
my field(0)=emp id
my filed(1)=emp name
my field(2)=manager id
Dim MyNodes As New Hashtable()
Dim node As New TreeNode
Dim dsRow as Datarow
For Each dsRow In ds1.Tables(0).Rows
If IsDBNull(dsRow("MgrID")) Then
Me.TreeView1.Nodes.Add(dsRow("EmpName"))
mynodes.add(dsrow("EmpID"),dsrow("EmpName"))
Else
DirectCast(MyNodes(dsRow("Mgr")), TreeNode).Add(dsRow("Ename")) <-------
this line giving error
End If
Next
Please advise what am I missing ?
Best Regards,
Luqman