C# CODE generate courseid like 1001 1002.. without repeating
i need a c# code for generate one course id when one button click, id like 1000 1001 1002 in this manner with out repeating
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shweta LodhaPosted Feb 2, 2014, 10:26 AM
You can store your initial number like 1000 in an integer variable and on every button click you can increment it by 1, if you are looking for a series.
If you want a random number starting with 1000, then you can use Random class to generate that as:
In below code: 1000 is the minimum and 5000 is the maximum. So, number will be generated between these two.