Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Auto generated serial number generated for one year
Posted
Updated 22-May-14 21:20pm
v3

Assuming you meant: "how to generate a serial number including a given year?", the answer is pretty simple: concatenate the year with a counter, e.g.
20140001
20140002
...

The actual implementation is trivial and left as an exercise.

[update (no one likes exercises anymore)]
VB
Public Function NextCode(ByVal year As Integer, ByRef counter As Integer) As Integer
  counter = counter + 1
  NextCode = year * 10000 + counter

End Function

Please note, that's really a naive implementation. You have to write more robust code.
[/update]
 
Share this answer
 
v2
Comments
tanugarg 23-May-14 3:22am    
please explain it how do i
Just Concatenate a year to Number
 
Share this answer
 
Comments
tanugarg 23-May-14 6:14am    
no this one, i want 1,2,3,4,5,6,...................................upto 100 for financial year, then year will be changed number start should be 1,2,3,4.............

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