trimming text!

vbnow

Member
Joined
Jan 6, 2002
Messages
5
Location
Southern Cal
I use to use this code to trim spaces like back spacing in vb6:

varlenght = Len(txtKeypad.Text) - 1
txtKeypad = Left(txtKeypad.Text, varlenght)

This does not work in vb.net.
Any suggestions please!!!

Thanks!
 
That ought to work fine, although you can now use the Length and SubString methods of the String class.
 
I am not 100% sure, but
I think that in vb.net
to use the left function you have to use it like this.....

Microsoft.Visualbasic.left(xxxxx,x,x)

Anystring.Substring seems to be a better way to do this.
 
Try this:

varlenght = Len(txtKeypad.Text) - 1
txtKeypad = mid(txtkeypad.text,1,varlength)

I use mid() for trimming of spaces and grabbing certain info from a string. Alot easier in my opinion. Hope it helps.

Slyprid
 
Thanks slyprid!

Your sollution worked. I only I had to add the .Text to the txtKeypad because vb.net does not allow shortcuts like vb6.

Thanks again! :rolleyes:
 


Write your reply...
Back
Top