Here is my code ...
WHat it should do ... is loop through array with addresses in it then display them on a richtextbox
However, it loops through does the first one .... then I have to click the button event again for it to get the 2nd one BUT THEN when I click button the 3rd time it doesnt do the third address it simply repeats number 2
Ok, I have moved myInt around ... I even tried putting the whole thing in a do while and then a do until HOwevr I may not hav done eithe of thos right either
Please help
I just need it to go through each and do to each what its supposed to
Oh ... I am going to include my xml file so you can see what its pulling from and to s if you might have any sugestions as to how to do this more efficiently
My XML
My CODE [
The future end result of this will be to remove the rtb code all together and replace it with code that will mark the addresses on a map ... I hav that code already written and it works great just ned to be able to search my xml with the addresses contained in the array and mark each point that it finds
Mark
WHat it should do ... is loop through array with addresses in it then display them on a richtextbox
However, it loops through does the first one .... then I have to click the button event again for it to get the 2nd one BUT THEN when I click button the 3rd time it doesnt do the third address it simply repeats number 2
Ok, I have moved myInt around ... I even tried putting the whole thing in a do while and then a do until HOwevr I may not hav done eithe of thos right either
Please help
I just need it to go through each and do to each what its supposed to
Oh ... I am going to include my xml file so you can see what its pulling from and to s if you might have any sugestions as to how to do this more efficiently
My XML
Code:
<?xml version ="1.0" encoding ="utf-8"?>
<Tulsa>
<Streets>
<Riverside S61="193,499,100" S71="276,708,1300" S81="400,916,1600" S91="530,1126" S101="589,1334">S Riverside Pkwy</Riverside>
<Peoria S61="277,498,1300" S71="271,680,1300">S Peoria Ave</Peoria>
<Lewis S61="485,498,2400" S71="485,707,2400" S81="485,916,2400" S91="553,1126,2500">S Lewis Ave</Lewis>
<Delaware S61="595,470,2800" S71="595,706,2800" S81="588,916,2800" S91="589,1335,2800">S Delaware Ave</Delaware>
<Harvard S61="" S71="" S81="692,916,3300" S91="" S101="">S Harvard Ave</Harvard>
<Yale S61="" S71="" S81="901,916,4900" S91="" S101="">S Yale Ave</Yale>
</Streets>
</Tulsa>
Code:
Dim myXML As XDocument
myXML = XDocument.Load(myXMLPath)
Dim myTempArr() As String
Dim stString() As String = {"6100 S Riverside Pkwy", "8100 S Yale Ave", "6100 S Peoria Ave"}
Dim myString As String = ""
Dim myEl() As String
myInt += 1
For i = 0 To UBound(stString)
If myInt > stString.Count - 1 Then
Exit For
Else
myString = stString(myInt)
End If
Next
myEl = myString.Split(" ")
For Each xa In myXML.Descendants
For i = 0 To myEl.Count - 1
If myEl(i).ToString() = xa.Name.ToString() Then
' MsgBox(myEl(i)) ' <<<<< Msgbox for testing code
If xa.Name = myEl(i) Then
myString = Microsoft.VisualBasic.Left(myString, 6).ToString()
Dim Sst As String = Microsoft.VisualBasic.Right(myString, 1)
Dim streetNum As String = Microsoft.VisualBasic.Left(myString, 4)
Dim tAtt As String = Sst & Microsoft.VisualBasic.Left(streetNum, 2)
' MsgBox("String equals - " & tAtt) ' <<<<< Msgbox for testing code
myTempArr = xa.Attribute(tAtt).Value.Split(",")
For myInt = 0 To UBound(myTempArr)
rtb1.Text = rtb1.Text & "Mouse Coordinates Are: " & myTempArr(0) & ", " & myTempArr(1) & vbCrLf _
& "The Hundred Block is " & myTempArr(2) & " E " & vbCrLf & _
"Which is " & myEl(i) & " & " & Microsoft.VisualBasic.Right(tAtt, 2) _
& "st ST" & vbCrLf & vbCrLf
Exit For ' Not sure about this Exit For .....
Next
End If
End If
Next
Next
The future end result of this will be to remove the rtb code all together and replace it with code that will mark the addresses on a map ... I hav that code already written and it works great just ned to be able to search my xml with the addresses contained in the array and mark each point that it finds
Mark