Using 1st two numbers from a textbox

Ja2984

Member
Joined
Nov 23, 2007
Messages
13
Programming Experience
Beginner
Hi all great people of wisdom. Sorry if this has already been covered in another thread but i've been saerching for nearly 2 hours now and havn't found a solution.

Is it possible to use just the first 2 characters/numbers of a textbox and store them as a value for later use?

eg

i enter "12345" into my textbox.

i want to store "12" as a value for later use.

The reason behind this is i need to use the first 2 numbers to define a folder location for my text files. My files are stored in folders from 01 to 30

e.g.

C:\06\06124.txt
C:\25\25090.txt
C:\12\12345.txt

location = only first 2 numbers

FileToCopy = "c:\" & location & "\" & Me.tfNumberTextBox.Text & ".txt"

therefore

FileToCopy = C:\06\06124.txt

Hope all this dribble makes sense, it is 1:00 in the morning afterall :confused:

Thanks for any help provided
 
Use the Substring method of String class. For example tb.Text.Substring(0,2) returns that.
 
Back
Top