Gopher2011
Well-known member
Forgive me but i have a noob question, I cant seem to get my head around.
I have a textbox.text string as "111.1, 22.2, 3333.3, 444.44"
What I want to is extract the numbers which may be random lengths, but all separated by a comma to
dim i1st number as Integer
dim i2nd number as Integer
dim i3rd number as Integer
dim i4th number as Integer
I know how to search for one instance of a string in a string but taking the 1st part to the comma, then the next comma and so on is confusing me. So any help or advice is appreciated big time.
I have a textbox.text string as "111.1, 22.2, 3333.3, 444.44"
What I want to is extract the numbers which may be random lengths, but all separated by a comma to
dim i1st number as Integer
dim i2nd number as Integer
dim i3rd number as Integer
dim i4th number as Integer
I know how to search for one instance of a string in a string but taking the 1st part to the comma, then the next comma and so on is confusing me. So any help or advice is appreciated big time.
VB.NET:
Dim SearchTxt As String
Dim lastIndex As Integer
Dim textEnd As Integer = txtDataReceived.TextLength
Dim index As Integer = 0
SearchTxt = "OK," 'Search for "OK," and act upon it
lastIndex = txtDataReceived.Text.LastIndexOf(SearchTxt) 'Find it
If lastIndex <> -1 Then '-1 if empty, 1 if found
Thread.Sleep(500)
txtDataReceived.Text = "" 'Delete from txtDataReceived.text
End If
SearchTxt = "a" 'Search for a and act upon it
lastIndex = txtDataReceived.Text.LastIndexOf(SearchTxt) 'Find it
If lastIndex <> -1 Then '-1 if empty, 1 if found
Thread.Sleep(500)
txtDataReceived.Text = "" 'Delete from txtDataReceived.text
EndiF