473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Help in converting to VB.NET

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

Nov 18 '05 #1
4 1232
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" <Pa*********@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
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

Nov 18 '05 #2
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
Nov 18 '05 #3
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" <Pa*********@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
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

Nov 18 '05 #4
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:%2****************@TK2MSFTNGP10.phx.gbl...
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" <Pa*********@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
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


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rex_chaos | last post by:
Hi all, I have a question about datatype converting. Consider the following types std::complex<double> and struct MyComplex { double re, im; }
4
by: jipster | last post by:
hi, i need help converting this java program to C++...are there any programs or nething that could be used to do this faster?? class hw2 { static public void main (String args) { hw2.test();}...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
3
by: alyssa | last post by:
Hi guys, May i know how to declare a string of binary data and pass it to the method? For example, int a={10010001120420052314} is it correct? and if i have receive the binary data, may i know...
4
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
13
by: Paraic Gallagher | last post by:
Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying...
16
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still...
2
anukagni
by: anukagni | last post by:
Hi, iam having an database for that i have created an user manual includes help topics ..I prepared in the word format and i want to covert this to html help . Iam having Ms Html workshop but i...
10
by: minterman | last post by:
1. the program needs to convert btu to jules 2. Convert calories to joules 3. Convert joules to joules 4 exit the program. if the user type anything other than 1-4 the program should print a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.