Click here to Skip to main content
16,018,294 members
Articles / Web Development / ASP.NET
Article

Alphanumeric increment in C#

Rate me:
Please Sign up or sign in to vote.
2.33/5 (16 votes)
11 Jun 2006 85.5K   4.8K   27   12
This code is very useful when you want to auto increment number using A-Z and 1-9 with possible combinationYou can pass any string and system will return next possible number e.g. You can Pass number "PRO01A9" then You will get "PRO01B1"

 Download source files - 439 Kb

Introduction

This code is useful when you want to generate number which can be auto-Alphanumeric increment  like product code or Item code this will generate next possible number using A-Z and 0-9 number. <o:p>

one good thing with this is you can always keep width of Number fix all the time system will always return number in same with as u passed one. <o:p>

So this solution will be application for following business requirements. <o:p>

  • When You want to generate Item code or product code with fix width <o:p>
  • Auto Increment based on last number so you don't have to manage any system this code will return same. <o:p>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Hi,
I proud to be a member of farmer family who use to grow like sugar cane, Capsicum. etc. And you know it very difficult to reach in IT industry who belongs to farmer. Any way I am working in wel know IT company in Pune, as Lead position, having almost 7+ yrs. of IT experience. Mainly in C#,Winforms and .NET related technology.
I hope my knowledge will help you guys to minimize your efforts
Thanks for giving me opportunity to minimize your some sleepless night.

Comments and Discussions

 
GeneralMy vote of 4 Pin
Chloe Lim23-Feb-11 19:11
Chloe Lim23-Feb-11 19:11 
GeneralAuto Increment Alphanumeric Pin
vaozvazer23-Sep-10 12:30
vaozvazer23-Sep-10 12:30 
GeneralSaved my hours Pin
Member 743864720-Sep-10 22:01
Member 743864720-Sep-10 22:01 
GeneralSaved me hours on my project Pin
Greg Olmstead7-Jul-10 10:56
Greg Olmstead7-Jul-10 10:56 
GeneralThis can be cut simplify. Pin
lilimalin6-Jan-09 14:01
lilimalin6-Jan-09 14:01 
Generalmeaning of the isAllZed and is AllNine in the program. Pin
tchshiping21-Sep-08 19:59
tchshiping21-Sep-08 19:59 
GeneralNot always using letters or numbers Pin
Mr. Candyman20-Feb-08 5:45
Mr. Candyman20-Feb-08 5:45 
QuestionAuto generate number a unique primary key Pin
ramakant_135211-Apr-07 2:45
ramakant_135211-Apr-07 2:45 
GeneralExcellent Pin
hongeu24-Mar-07 0:02
hongeu24-Mar-07 0:02 
QuestionHuh? Pin
Paul Conrad30-Jun-06 20:35
professionalPaul Conrad30-Jun-06 20:35 
GeneralNext value Pin
woo_hoo22-Apr-06 3:05
woo_hoo22-Apr-06 3:05 
GeneralRe: Next value Pin
je_gonzalez10-Feb-09 14:58
je_gonzalez10-Feb-09 14:58 
Actually it should be PRO01BA, but it depends on the definition of the number set. My assumption is based on using the U.S. alphabet in its common order (uppercase only) and the digits in their numerical value (A-Z0-9). Whether digits are before letters do not matter (0-9A-Z), as the rollover would always be A. This definition is called base 36 and I have used it for years.

You would be correct if the set is A-Z1-90, which has the drawback of making the value very difficult to sort.

Big Grin | :-D Big Grin | :-D

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.