GuidStatic: NewGuid |
Initializes a new instance of the Guid object.
Public Function NewGuid ( ) As Guid
This is a convenient static method that you can call to get a new Guid.
The chance that the value of the new Guid will be all zeros or equal to any other Guid is very low. You can determine whether a GUID consists of all zeros by comparing it to Guid.EmptyGuid.
The following example creates and displays the values of two Guid objects.
Private Sub Main() Dim g As Guid Set g = Guid.NewGuid Debug.Print g.ToString Debug.Print Guid.NewGuid.ToString End Sub ' This code produces the following output. ' ' c35cb7df-7deb-4959-b40a-e9c67dad4131 ' 91cf364c-d276-4068-b47d-d47b52872c83