mousemat24
asked on
Need help in converting VB.NET to C#
Can someone please help me convert this VB.NET to C#
Thanks
Dim a As Integer
With dsTree.Tables(0)
For a = 0 To .Rows.Count - 1
If .Rows(a).Item("MNU_ParentN odeID") = 0 Then
Dim tn As New TreeNode(.Rows(a).Item("MN U_DisplayN ame"), .Rows(a).Item("MNU_ID").To String, "", .Rows(a).Item("MNU_URL"), "")
RecursivelyAddToNode(tn, .Rows(a).Item("MNU_ID"))
TreeView1.Nodes.Add(tn)
End If
Next
End With
Private Sub RecursivelyAddToNode(ByVal mymenuitem As TreeNode, ByVal ParentID As Integer)
Dim dv As New DataView(dsTree.Tables(0))
dv.RowFilter = ("MNU_ParentNodeID=" & ParentID.ToString)
Dim r As DataRowView
For Each r In dv
Dim tn As New TreeNode(r.Item("MNU_Displ ayName"), r.Item("MNU_ID").ToString, "", r.Item("MNU_URL"), "")
mymenuitem.ChildNodes.Add( tn)
RecursivelyAddToNode(tn, r.Item("MNU_ID"))
Next
End Sub
Many thanks
Thanks
Dim a As Integer
With dsTree.Tables(0)
For a = 0 To .Rows.Count - 1
If .Rows(a).Item("MNU_ParentN
Dim tn As New TreeNode(.Rows(a).Item("MN
RecursivelyAddToNode(tn, .Rows(a).Item("MNU_ID"))
TreeView1.Nodes.Add(tn)
End If
Next
End With
Private Sub RecursivelyAddToNode(ByVal
Dim dv As New DataView(dsTree.Tables(0))
dv.RowFilter = ("MNU_ParentNodeID=" & ParentID.ToString)
Dim r As DataRowView
For Each r In dv
Dim tn As New TreeNode(r.Item("MNU_Displ
mymenuitem.ChildNodes.Add(
RecursivelyAddToNode(tn, r.Item("MNU_ID"))
Next
End Sub
Many thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks ozymandias !!!
foreach (dataRow row in dsTree.Tables[0].Rows){
if ((int)row["MNU_ParentNodeI
TreeNode node = new TreeNode(row["MNU_DisplayN
RecursivelyAddToNode(node,
TreeView1.Nodes.Add(node)
}
}