Constructors: NewGuid

NewGuid

Initializes a new instance of the Guid object by using the specified array of bytes, string, or memory pointer.



 Public Function NewGuid(
	  ByRef Value As Variant ) As Guid

Parameters

Value
[ByRef] Variant. An array of bytes, string, or memory pointer.

Return Values

Guid -  A Guid initialized with values from Value.

Remarks

A new Guid can be initialized from a specified array of bytes, string, or memory pointer.

Data TypeDescription
String

A string that contains a GUID in one of the following formats ("d" represents a hexadecimal digit whose case is ignored):

32 contiguous Digits:

dddddddddddddddddddddddddddddddd

-or-

Groups of 8, 4, 4, 4, and 12 digits with hyphens between the groups. The entire GUID can optionally be enclosed in matching braces or parentheses:

dddddddd -dddd - dddd - dddd - dddddddddddd

-or-

{dddddddd-dddd-dddd-dddd-dddddddddddd}

-or-

(dddddddd-dddd-dddd-dddd-dddddddddddd)

-or-

Groups of 8, 4, and 4 digits, and a subset of eight groups of 2 digits, with each group prefixed by "0x" or "0X", and separated by commas. The entire GUID, as well as the subset, is enclosed in matching braces:

{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}

All braces, commas, and "0x" prefixes are required. All embedded spaces are ignored. All leading zeros in a group are ignored.

Byte ArrayA 16-element byte array containing values with which to initialize the GUID.
LongA pointer to a memory location to read 16 consecutive bytes with which to initialize the GUID.

Exceptions

ExceptionCondition
ArgumentNullExceptionbyte array is null.
ArgumentExceptionbyte array is not 16 bytes long.
FormatExceptionstring format is invalid.

See Also

Project CorLib Overview

Class Constructors Overview