What is a GUID and how to create one?
Question: I am trying to create a unique identifier. I know that I want to create a GUID for this from what I have been reading. What is a GUID and how can I create one?
Answer: By definition a Globally Unique Identifier (GUID) is a 128 bit integer that is considered statistically unique. They are perfect for creating things like unique identifiers for messages and session ID’s. The .NET Framework provides a GUID structure that represents a single GUID value. GUID strings by convention are represented in a hyphenated string as a series of lower case hexadecimal digits in groups of 8,4,4,4 and 12.
Place the following code into a button on a form to create a GUID.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim myGUID As Guid = myGUID.NewGuid
MsgBox(Guid.NewGuid.ToString)
End Sub