GuidStatic: NewGuid

NewGuid

Initializes a new instance of the Guid object.



 Public Function NewGuid ( ) As Guid

Return Values

Guid -  A new Guid object.

Remarks

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.

Examples

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

See Also

Project CorLib Overview

Class GuidStatic Overview

EmptyGuid

Guid