Vb6 Help!:)

Soldato
Joined
8 Oct 2003
Posts
2,888
Location
Glasgow
hi im looking for a function do to the following

(12345 example1), i want to remove example1 and keep the numeric 12345, however 12345 can change in length ie 123/12 i have tried (left x) but its not good enuff due to the chaning sizes of the left side of my string.

Cheers for the help kevin!
 
Not the most elegant example:-

Code:
Dim splitChar As String
Dim textToSplit As String

Dim resultText As String

splitChar = " "
textToSplit = Text1.Text

resultText = Trim(Mid(textToSplit, 1, InStr(textToSplit, splitChar)))

Text2.Text = resultText
 
You can also do it like this:-

Code:
Dim splitArr
Dim result As String

splitArr = Split("12345 Test", " ")
 
result = splitArr(0)

Text2.Text = result
 
Back
Top Bottom