Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 how to generate automatic number
Posted by abhi on  6/26/2009 12:29:30 AM Category: ADO.NET
Add to my favorites
Email to friend
how to generate automatic number like 05b61f001,05b61f002

Post Your Reply Post New Question

 Viewer's Reply
Use random number function
Answered By Salinee sachan on 6/26/2009 6:02:41 AM
Public Function RandomNumber(ByVal MaxNumber As Integer, Optional ByVal MinNumber As Integer = 0) As Integer
'initialize random number generator
Dim r As New Random(System.DateTime.Now.Millisecond)
'if passed incorrect arguments, swap them
'can also throw exception or return 0
If MinNumber > MaxNumber Then
Dim t As Integer = MinNumber
MinNumber = MaxNumber
MaxNumber = t
End If
Return r.Next(MinNumber, MaxNumber)
End Function
this function return a number between min and max value hope this help you
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
No Nonsense XML Web Development With PHP - Free 146 Page Preview!
Windows 8: 50 Questions and Answers You Need to Make a Decision (Normally $9.95)
Programmers Heaven C# School Book - Free 338 Page eBook