Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland asked on

VB.net 2010

Hi

I need to generate a unique ID eg 56776. What VB code do I use and how do I make sure that it isn't entered twice
Visual Basic.NET

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon
Nasir Razzaq

Describe the context as well. Is it for a primary field in DB? Why not use an Identity field? Or you can use a GUID
macksm

Explain your requirement properly.or the context  in which you need this.Making Id field primary key is enough to check duplicates
fernandovitale

Describe the context. You can use this:

Dim ID_Field As Guid = Guid.NewGuid()

Open in new window

Your help has saved me hundreds of hours of internet surfing.
fblack61
Murray Brown

ASKER
Hi

It is not a primary key. I am recreating an adapted version of Pastal Accounting and there is a transactionID which is secondry to the main ID field
Nasir Razzaq

Would a random number work? Or does the number need to be in sequence?
Murray Brown

ASKER
the number needs to be in sequence
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Nasir Razzaq

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Murray Brown

ASKER
thanks