GUIDs

  • Thread starter Thread starter Brad Allison
  • Start date Start date
B

Brad Allison

I usually use numerics with a random number generator for my unique ID fields in my tables, however I have an instance where I would like to use GUIDs (since this key will never be used or seen by the end user). Here is the start of my code:
Dim myGuid1 As New Guid()

JrEventID = myGuid1.ToString

txtEventID.Text = JrEventID

How do I generate a new GUID? Is is a simple process?

Thanks for the information.

Brad
 
Check out the Guid.NewGuid Method:

http://msdn.microsoft.com/library/d...ref/html/frlrfSystemGuidClassNewGuidTopic.asp


-- thanks~
Jennifer Perret [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
I usually use numerics with a random number generator for my unique ID fields in my tables, however I have an instance where I would like to use GUIDs (since this key will never be used or seen by the end user). Here is the start of my code:
Dim myGuid1 As New Guid()

JrEventID = myGuid1.ToString

txtEventID.Text = JrEventID

How do I generate a new GUID? Is is a simple process?

Thanks for the information.

Brad
 
Jennifer,

Thanks for the help, but every time I run this method, I get the following for a GUID: 00000000-0000-0000-0000-000000000000. I was under the understanding that this method was in a way like RANDOMIZE. Am I missing something?

Thanks again for the information.

Brad
Check out the Guid.NewGuid Method:

http://msdn.microsoft.com/library/d...ref/html/frlrfSystemGuidClassNewGuidTopic.asp


-- thanks~
Jennifer Perret [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
I usually use numerics with a random number generator for my unique ID fields in my tables, however I have an instance where I would like to use GUIDs (since this key will never be used or seen by the end user). Here is the start of my code:
Dim myGuid1 As New Guid()

JrEventID = myGuid1.ToString

txtEventID.Text = JrEventID

How do I generate a new GUID? Is is a simple process?

Thanks for the information.

Brad
 
Hi Brad,

You sure that your code is correct - I mean you look at the right guid?
NewGuid generates random GUID and not empty one.
You should do:

Dim g as Guid = Guid.NewGuid()
Console.WriteLine(g)

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
Jennifer,

Thanks for the help, but every time I run this method, I get the following for a GUID: 00000000-0000-0000-0000-000000000000. I was under the understanding that this method was in a way like RANDOMIZE. Am I missing something?

Thanks again for the information.

Brad
Check out the Guid.NewGuid Method:

http://msdn.microsoft.com/library/d...ref/html/frlrfSystemGuidClassNewGuidTopic.asp


-- thanks~
Jennifer Perret [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
I usually use numerics with a random number generator for my unique ID fields in my tables, however I have an instance where I would like to use GUIDs (since this key will never be used or seen by the end user). Here is the start of my code:
Dim myGuid1 As New Guid()

JrEventID = myGuid1.ToString

txtEventID.Text = JrEventID

How do I generate a new GUID? Is is a simple process?

Thanks for the information.

Brad
 
Thank you Miha, it now works. You are always quick to respond and are very helpful to somebody who is new to .NET.

Brad
"Miha Markic" <miha at rthand com> wrote in message Hi Brad,

You sure that your code is correct - I mean you look at the right guid?
NewGuid generates random GUID and not empty one.
You should do:

Dim g as Guid = Guid.NewGuid()
Console.WriteLine(g)

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
Jennifer,

Thanks for the help, but every time I run this method, I get the following for a GUID: 00000000-0000-0000-0000-000000000000. I was under the understanding that this method was in a way like RANDOMIZE. Am I missing something?

Thanks again for the information.

Brad
Check out the Guid.NewGuid Method:

http://msdn.microsoft.com/library/d...ref/html/frlrfSystemGuidClassNewGuidTopic.asp


-- thanks~
Jennifer Perret [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
I usually use numerics with a random number generator for my unique ID fields in my tables, however I have an instance where I would like to use GUIDs (since this key will never be used or seen by the end user). Here is the start of my code:
Dim myGuid1 As New Guid()

JrEventID = myGuid1.ToString

txtEventID.Text = JrEventID

How do I generate a new GUID? Is is a simple process?

Thanks for the information.

Brad
 
:) Thanks for the kind words.

Miha
Thank you Miha, it now works. You are always quick to respond and are very
helpful to somebody who is new to .NET.

Brad
"Miha Markic" <miha at rthand com> wrote in message
news:[email protected]...
 
Back
Top