Hi. Lets say i have a textbox with the string "This is a text box" entered into it. What code can i use to read the first letter or character in the text box (in this example, "T") and then delete the first letter, leaving "his is a text box"?
Printable View
Hi. Lets say i have a textbox with the string "This is a text box" entered into it. What code can i use to read the first letter or character in the text box (in this example, "T") and then delete the first letter, leaving "his is a text box"?
Code:left(text1.text,1) 'Show "T"
right(text1.text,len(text1.text)-1) ' Show text without first "T"
for deleting the first character, you could also use Mid$:Code:Text1.Text = Mid$(Text1.Text1, 2)
Even shorter, use Mid$ to remove the first character
I also prefer to be strict and use Left$, Mid$, Right$ etc which enforce variable type. Without the dollar sign they return variants.Code:Text1 = Mid$(Text1, 2)
Edit - Snap, Bushmobile!