Help in converting to VB.NET

Discussion in 'ASP .Net' started by Guest, Oct 22, 2004.

  1. Guest

    Guest Guest

    Hi All,
    Can anybody help in converting the code below to VB.NEt thanks.
    I need the loop converted..
    thanks

    Private Sub expandCollapseAllTreeviewNodes(ByVal nodes As
    TreeNodeCollection, ByVal expand As Boolean)
    Dim node As TreeNode
    'Loop through each node of the collection and expand it.
    For Each node In nodes
    if(expand)
    {
    node.Expanded = true;
    expandCollapseAllTreeviewNodes(node.Nodes, expand)

    }
    else

    {
    node.Expanded = true;
    expandCollapseAllTreeviewNodes(node.Nodes, expand)

    }


    Next
     
    Guest, Oct 22, 2004
    #1
    1. Advertisements

  2. Guest

    Karl Guest

    The code below is like 80% in VB.Net..and the FOR loop is converted.....

    Private Sub expandCollapseAllTreeviewNodes(ByVal nodes As
    TreeNodeCollection, ByVal expand As Boolean)
    For Each node As TreeNode In nodes
    If expand Then
    node.Expanded = True
    expandCollapseAllTreeviewNodes(node.Nodes, expand)
    Else
    node.Expanded = True
    expandCollapseAllTreeviewNodes(node.Nodes, expand)
    End If
    Next
    End Sub


    Karl
     
    Karl, Oct 22, 2004
    #2
    1. Advertisements

  3. Guest

    Scott M. Guest

    Private Sub expandCollapseAllTreeviewNodes(ByVal nodes As
    TreeNodeCollection, ByVal expand As Boolean)
    Dim node As TreeNode
    'Loop through each node of the collection and expand it.
    For Each node In nodes
    If expand Then
    node.Expanded = true
    expandCollapseAllTreeviewNodes(node.Nodes, expand)
    Else
    node.Expanded = true
    expandCollapseAllTreeviewNodes(node.Nodes, expand)
    End If
    Next
    End Sub
     
    Scott M., Oct 22, 2004
    #3
  4. The majority of what you have shown can be converted simply by removing the
    semicolons. The IF needs a Then at the end of the line and you need to turn
    the final } into an End If.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************************************************
    Think outside the box!
    *************************************************
     
    Cowboy \(Gregory A. Beamer\), Oct 22, 2004
    #4
  5. Guest

    Scott M. Guest

    For Each node As TreeNode In nodes....

    Should be: For Each node In nodes

    since "nodes" is already declared as TreeNodeCollection
     
    Scott M., Oct 22, 2004
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.