Help in converting to VB.NET

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 22, 2004.

  1. 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
     
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 22, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    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

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Patrick.O.Ige" <> wrote in message
    news:...
    > 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
    >
     
    Karl, Oct 22, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    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!
    *************************************************
    "Patrick.O.Ige" <> wrote in message
    news:...
    > 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
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 22, 2004
    #4
  5. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Scott M. Guest

    For Each node As TreeNode In nodes....

    Should be: For Each node In nodes

    since "nodes" is already declared as TreeNodeCollection



    "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
    message news:%...
    > 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
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Patrick.O.Ige" <> wrote in message
    > news:...
    >> 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
    >>

    >
    >
     
    Scott M., Oct 22, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wayfarer
    Replies:
    1
    Views:
    2,679
    =?Utf-8?B?QmhhcmF0IEJpeWFuaQ==?=
    Jul 31, 2004
  2. Fredrik Rodin
    Replies:
    2
    Views:
    4,969
    Fredrik Rodin
    Nov 4, 2005
  3. =?Utf-8?B?U2VyZ2lvIE1hcnRpbnM=?=

    Converting Web Site from Vb.Net 2003 to Vb.Net 2005

    =?Utf-8?B?U2VyZ2lvIE1hcnRpbnM=?=, Feb 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    569
    =?Utf-8?B?U2VyZ2lvIE1hcnRpbnM=?=
    Feb 21, 2006
  4. =?Utf-8?B?anJldHQ=?=
    Replies:
    1
    Views:
    939
    Laurent Bugnion
    Sep 26, 2006
  5. Girish
    Replies:
    1
    Views:
    279
    Bob Barrows
    Feb 16, 2004
Loading...

Share This Page