GuidStatic |
Name | Description |
---|---|
EmptyGuid (get) | Returns a guid that is guaranteed to be all zeros. |
IDispatchGuid (get) | A constant Guid representing the IDispatch interface UUID. |
IUnknownGuid (get) | A constant Guid representing the IUnknown interface UUID. |
Name | Description |
---|---|
FromParts | Creates a guid using specified values and byte array. |
FromValues | Creates a new guid from the individual values and bytes. |
NewGuid | Initializes a new instance of the Guid object. |
Parse | Converts the string representation of a GUID to the equivalent Guid object. |
ParseExact | Converts the string representation of a GUID to the equivalent Guid object. |
ReadOnly | Returns a Read-Only wrapper for the supplied Guid object. |
TryParse | Converts the string representation of a GUID to the equivalent Guid object. |
TryParseExact | Converts the string representation of a GUID to the equivalent Guid object, provided that the string is in the specified format. |
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
Note |
---|
The VBCorLib Guid conflicts with a hidden type in Visual Basic. In order to specific the VBCorLib version of Guid, a variable can be defined as CorLib.Guid instead of just Guid. Alternatively, moving the reference priority for the VBCorLib library above OLE Automation will give CorLib.Guid priority when a variable is declared. |
The code parses a guid string then displays the guid in various formats.
Private Sub Main() Dim g As Guid Set g = Guid.Parse("{533217B3-CDEC-40A2-B01C-1EA8593B850F}") Debug.Print "Display guid with various formats." Debug.Print " D = " & g.ToString("D") Debug.Print " B = " & g.ToString("B") Debug.Print " P = " & g.ToString("P") Debug.Print " N = " & g.ToString("N") Debug.Print " X = " & g.ToString("X") End Sub ' This code produces the following output. ' ' Display guid with various formats. ' D = 533217b3-cdec-40a2-b01c-1ea8593b850f ' B = {533217b3-cdec-40a2-b01c-1ea8593b850f} ' P = (533217b3-cdec-40a2-b01c-1ea8593b850f) ' N = 533217b3cdec40a2b01c1ea8593b850f ' X = {0x533217b3,0xcdec,0x40a2,{0xb0,0x1c,0x1e,0xa8,0x59,0x3b,0x85,0x0f}}