Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET Parsing an Object type to a GUID type

Tags:

vb.net

how can I convert an object type to a GUID type in VB.NET?

like image 892
jerbersoft Avatar asked May 12 '09 10:05

jerbersoft


2 Answers

I'm not sure what exactly you want but this might help:

Dim g = CType(obj, System.Guid)

If you want to convert a string to a Guid:

Dim g = New Guid(myString)
like image 61
mmx Avatar answered Oct 06 '22 14:10

mmx


If you are looking to create the object as a new guid, use the following call:

dim objvar as guid = System.GUID.NewGuid()

edit Your question is a little unclear when you say "convert". If you already have the object created and assigned, use DirectCast to create an object that the Visual Studio environment will recognize.

like image 20
FaultyLogic Avatar answered Oct 06 '22 12:10

FaultyLogic