|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
is Recursive Procedures/Function what i need to solve my problem?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 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" <dotnetn***@discussions.microsoft.com> a écrit dans le message de news: B3413309-9013-41BE-8310-C1036270B***@microsoft.com...Show quoteHide quote > 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 Thank you, i got my mind wrap around on this program that i miss the most
simple element of it. Show quoteHide quote "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" <dotnetn***@discussions.microsoft.com> a écrit dans le message > de news: B3413309-9013-41BE-8310-C1036270B***@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 > > > 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
Inherited form problem
Function 'GetData' doesn't return a value on all code paths... Threading and Scope Dynamically created checkboxes within a panel - how do i get the value? how to: contents of cd Making Tag with Web.UI.Control Batch file question Image access problem Multiline combobox Datagrid & combobox |
|||||||||||||||||||||||