473,378 Members | 1,671 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,378 software developers and data experts.

is Recursive Procedures/Function what i need to solve my problem?

this is my code
Do
Dim nn As String

Dim strNetControl As String = CStr(arlsNetControl.Item(y))
rootDoc.Load(strNetControl)
lsSubNetInst =
rootDoc.SelectNodes("/NetworkController/Subnets/Subnet/SubnetProperties/@NetworkNumber")
str1 = strNetControl.Substring(0, strNetControl.LastIndexOf("."))

For Each nSubNetInst In lsSubNetInst
arlsSubNetInst.Add(nSubNetInst.InnerText)
Next
nn = CStr(arlsSubNetInst.Item(y))

Dim intR As Integer = NxInstNum + 2

strSubNet = str1 + "_" + "200" + "." + nn + "_" + "199" + "." +
CStr(intR) + ".xml"
cboJobSite.Items.Add(strSubNet)

y += 1
Loop Until y = x

what i need is for CStr(intR) to increase by two each time when i loop it
thur. it suppose to loop 12 time and each time the build up on the file alway
end up with same number which is 3752. the variable NxInstNum is 3750.

since it must loop thur 12 time each time the build up file should be

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3752.xml

then

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3754.xml

and so on...

does anyone know what i'm doing wrong or missing?

thanks
Jul 13 '06 #1
3 1520
Dim intR As Integer = NxInstNum + 2 and as NxInstNum never change you alway
suse the same value.

Move Dim intR As Integer = NxInstNum outisde of your llop and use
intR=intR+2 inside your loop.

--
Patrice

"dotnetnoob" <do********@discussions.microsoft.coma écrit dans le message
de news: B3**********************************@microsoft.com...
this is my code
Do
Dim nn As String

Dim strNetControl As String = CStr(arlsNetControl.Item(y))
rootDoc.Load(strNetControl)
lsSubNetInst =
rootDoc.SelectNodes("/NetworkController/Subnets/Subnet/SubnetProperties/@NetworkNumber")
str1 = strNetControl.Substring(0,
strNetControl.LastIndexOf("."))

For Each nSubNetInst In lsSubNetInst
arlsSubNetInst.Add(nSubNetInst.InnerText)
Next
nn = CStr(arlsSubNetInst.Item(y))

Dim intR As Integer = NxInstNum + 2

strSubNet = str1 + "_" + "200" + "." + nn + "_" + "199" + "." +
CStr(intR) + ".xml"
cboJobSite.Items.Add(strSubNet)

y += 1
Loop Until y = x

what i need is for CStr(intR) to increase by two each time when i loop it
thur. it suppose to loop 12 time and each time the build up on the file
alway
end up with same number which is 3752. the variable NxInstNum is 3750.

since it must loop thur 12 time each time the build up file should be

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3752.xml

then

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3754.xml

and so on...

does anyone know what i'm doing wrong or missing?

thanks

Jul 13 '06 #2
There is no need for recursion.
I assume that x and y are set outside of this code snippet.

The problem is your positioning of
Dim intR As Integer = NxInstNum + 2
Since NxInstNum = 3750, and that variable is never changed, your result
will always be 3752.

Actually, I'm surprised that you aren't getting errors out the
ying/yang with this code. The same variables are dimensioned in every
iteration of the loop. Older versions of VB would have cried about
that.

Try this instead:

Dim nn As String = ""
Dim strNetControl As String = ""
Dim intR As Integer = NxInstNum
Do
strNetControl = CStr(arlsNetControl.Item(y))
rootDoc.Load(strNetControl)
lsSubNetInst =

rootDoc.SelectNodes("/NetworkController/Subnets/Subnet/SubnetProperties/@NetworkNumber")
str1 = strNetControl.Substring(0, strNetControl.LastIndexOf("."))
For Each nSubNetInst In lsSubNetInst
arlsSubNetInst.Add(nSubNetInst.InnerText)
Next
nn = CStr(arlsSubNetInst.Item(y))
intR += 2
strSubNet = str1 + "_" + "200" + "." + nn + "_" + "199" + "." +
CStr(intR) + ".xml"
cboJobSite.Items.Add(strSubNet)
y += 1
Loop Until y = x

Jul 13 '06 #3
Thank you, i got my mind wrap around on this program that i miss the most
simple element of it.

"Patrice" wrote:
Dim intR As Integer = NxInstNum + 2 and as NxInstNum never change you alway
suse the same value.

Move Dim intR As Integer = NxInstNum outisde of your llop and use
intR=intR+2 inside your loop.

--
Patrice

"dotnetnoob" <do********@discussions.microsoft.coma écrit dans le message
de news: B3**********************************@microsoft.com...
this is my code
Do
Dim nn As String

Dim strNetControl As String = CStr(arlsNetControl.Item(y))
rootDoc.Load(strNetControl)
lsSubNetInst =
rootDoc.SelectNodes("/NetworkController/Subnets/Subnet/SubnetProperties/@NetworkNumber")
str1 = strNetControl.Substring(0,
strNetControl.LastIndexOf("."))

For Each nSubNetInst In lsSubNetInst
arlsSubNetInst.Add(nSubNetInst.InnerText)
Next
nn = CStr(arlsSubNetInst.Item(y))

Dim intR As Integer = NxInstNum + 2

strSubNet = str1 + "_" + "200" + "." + nn + "_" + "199" + "." +
CStr(intR) + ".xml"
cboJobSite.Items.Add(strSubNet)

y += 1
Loop Until y = x

what i need is for CStr(intR) to increase by two each time when i loop it
thur. it suppose to loop 12 time and each time the build up on the file
alway
end up with same number which is 3752. the variable NxInstNum is 3750.

since it must loop thur 12 time each time the build up file should be

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3752.xml

then

C:\eBuilding\config\client\Data\Site_7415\800.7415 _801.101_8.115_200.391_199.3754.xml

and so on...

does anyone know what i'm doing wrong or missing?

thanks


Jul 13 '06 #4

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

Similar topics

19
by: Carlos Ribeiro | last post by:
Hello all, Here I am using some deeply nested, tree-like data structures. In some situations I need to traverse the tree; the old-style way to do it is to write a recursive method on the node...
10
by: Steve Goldman | last post by:
Hi, I am trying to come up with a way to develop all n-length permutations of a given list of values. The short function below seems to work, but I can't help thinking there's a better way. ...
4
by: deko | last post by:
When I loop through this function, it works fine until it hits End Function - then it jumps to End Select. Very strange... This behavior occurs when Case = 255. Any ideas why this is happening? ...
4
by: Victor | last post by:
Hello, I've got a situation in which the number of (valid) recursive calls I make will cause stack overflow. I can use getrlimit (and setrlimit) to test (and set) my current stack size. ...
9
by: Bill Borg | last post by:
Hello, I call a function recursively to find an item that exists *anywhere* down the chain. Let's say I find it five layers deep. Now I've got what I need and want to break out of that whole...
5
by: purushneel | last post by:
Hi, I work primarily on Oracle databases. I am trying to convert a recursive stored procedure written in Oracle to DB2. Does DB2 UDB v8.2 (Windows/AIX) supports recursive stored procedures ??...
14
by: Fabian Steiner | last post by:
Hello! I have got a Python "Device" Object which has got a attribute (list) called children which my contain several other "Device" objects. I implemented it this way in order to achieve a kind...
41
by: Harry | last post by:
Hi all, 1)I need your help to solve a problem. I have a function whose prototype is int reclen(char *) This function has to find the length of the string passed to it.But the conditions...
3
by: AliRezaGoogle | last post by:
Dear Members, I have written a recursive function. It calls itself recursively. It is placed inside a thread. So I can easily suspend and resume the thread to suspend or resume the function as...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.