String handling

  • Thread starter Thread starter Gary Napolitano
  • Start date Start date
G

Gary Napolitano

I have a textbox that I want to sort user input from.

The field will contain 20 characters containing randomly placed
alpha, numeric, and other characters.

I want to strip out the alpha (A,B,C) and other characters like
+ @ & and only leave a 15 digit number.

Any help would be really appreciated.

BTW, I'm using vb.net 2002.


Regards,

Gary
 
Try this:

dim i as integer
dim AlphNum, temp as string
dim aNum as long

AlphNum=Textbox1.Text ' Get Alphanumeric from Textbox
temp="" ' Initialize temp
for i = 1 to Len(AlphNum) ' Step through each character
if IsNumeric(Mid(AlphNum,i,1)) then ' if a number
temp=temp & Mid(AlphNum,i,1) ' add to temp
end if
Next i
aNum=CLng(temp) ' change string to number
(optional)

Kim
 
Back
Top