Quick, stupid question for a braindead programmer

Brad4566

Brad
Local time
Today, 09:42
Joined
Nov 19, 2004
Messages
8
I am trying to remember what code you would use to select how many characters you want out of a textbox. An example would be: I have a text box with the following in it, "141# UP". What could I use to select just the first three characters and toss them into a variable. Then select the remaining characters minus the # sign and the space and toss that into a variable. I can't remember the code for that. Thanks in advance for the help.
 
Assuming txtMyString = "141# UP"
for the first part:-
txtMyText = left(txtMyString,3)

and if the first number varies, then use instr on for the 2nd part as below. You may have to use instr for the 1st part also, if the number changes size.

txtMyText = mid(txtMyString , instr(txtMyString,"# ")+2)
 
Last edited:
Thank you for that. That is the code that I was looking for
 

Users who are viewing this thread

Back
Top Bottom