View Single Post
Old 02-01-2013, 06:43 PM   #2
Tawpie
NOOB, Not Quite a Regular!
 
Tawpie's Avatar
 
Join Date: Jul 2012
Location: Van
Posts: 30
Thanked 3 Times in 3 Posts
Failed 1 Time in 1 Post
Quote:
'Invoice ID: to display last 3 digits of customer number and Initals of Name. Eg. EL725
For this, you will need to learn these functions: GetChar, Split, and ToString. Oh and, a basic understanding of concatenation.

I'm not going to put the code in here because I don't have any IDE to test the code, but I'll explain the steps required to achieve your objective.

1. Store their name in a variable, lets call this name.

2. Use Split method of String class to break name into two chunks INTO an array. (Tips: Space is the default Delimiter, and set the appropriate number for Limit to ensure you're only getting two letters.)

3. Use a for loop, use the GetChar method of String class to take the first indexed character of each string in your array. Store each char to a variable

4. Use the Right method of String class to grab the 3 numbers of your customer number.

5. Concatenate everything together to form XXnnn.

Hope this helps. I would code it if I had an IDE for VB, but I don't.
Tawpie is offline   Reply With Quote
This post thanked by: