Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i would like to know if i have a textboxt with alpha numeric numbers 001 ,002,003 , numbers.text, and a second textbox called suffix.text how would i be able to auto increment the suffix so if the user enters 001 as the first entry in the numbers.text and then the next value you they add in the numbers.text is 001,i need the suffix.text to automatically show, A
so it would look like

number.text suffix.text
001
001 a
001 b
002
002 a

Etc
Posted
Comments
[no name] 15-Aug-12 7:36am    
Sure... go right ahead and do that.

1 solution

I would use a linked list (or any equivalent present in VB.NET) to store a struct with the pairs of values and suffixes.
Then after each entry I would count the values that are equal than the one you've entered (so this should be done in the change event of the editbox).
It all depends on what you want to do in terms of the suffixes, I would try to use the ascii table to increment the suffix automatically and if you are overflowing the "z" char due to an amount of z+# of values equal than the last one entered, then I would start adding another ascii start "a".

Using ascii makes it easy to change letters by calculus.

Control the overflow and then you are done...

This is not code but a bunch of ideas that could help you.

Good luck.
 
Share this answer
 
Comments
[no name] 15-Aug-12 9:18am    
5 for answering the question without doing his homework for him.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900