|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GUIDS not creating correctly in vb.netI'm a newbie to .net (7 years or so as a vb/asp programmer) and I'm trying to create a GUID using the GUID type in vb.net Here's the code I'm using to create it : Public Function CreateGUID() As String Dim objGUID As Object objGUID = New Guid CreateGUID = objGUID.ToString End Function This function returns to me a formatted string that kinda looks like a GUID, but it is all zeros - can anyone help? Cheers, Doug. Note that you declared the variable as type Object (but that's not it.)
You've created a blank GUID so you're seeing zeros. Instead of a separate function try putting this in place of the call to your function. Dim s As String s = Guid.NewGuid.ToString Don't even need to instantiate a Guid object to get it. Tom <d***@dodeonline.com> wrote in message Show quoteHide quote news:1163286613.497291.126070@h48g2000cwc.googlegroups.com... > G'day all, > > I'm a newbie to .net (7 years or so as a vb/asp programmer) and I'm > trying to create a GUID using the GUID type in vb.net > > Here's the code I'm using to create it : > > Public Function CreateGUID() As String > Dim objGUID As Object > objGUID = New Guid > CreateGUID = objGUID.ToString > End Function > > This function returns to me a formatted string that kinda looks like a > GUID, but it is all zeros - can anyone help? > > Cheers, > > Doug. > Thanks Tom - that worked a treat :)
Cheers, Doug. Tom Leylan wrote: Show quoteHide quote > Note that you declared the variable as type Object (but that's not it.) > You've created a blank GUID so you're seeing zeros. > > Instead of a separate function try putting this in place of the call to your > function. > > Dim s As String > s = Guid.NewGuid.ToString > > Don't even need to instantiate a Guid object to get it. > > Tom > > > <d***@dodeonline.com> wrote in message > news:1163286613.497291.126070@h48g2000cwc.googlegroups.com... > > G'day all, > > > > I'm a newbie to .net (7 years or so as a vb/asp programmer) and I'm > > trying to create a GUID using the GUID type in vb.net > > > > Here's the code I'm using to create it : > > > > Public Function CreateGUID() As String > > Dim objGUID As Object > > objGUID = New Guid > > CreateGUID = objGUID.ToString > > End Function > > > > This function returns to me a formatted string that kinda looks like a > > GUID, but it is all zeros - can anyone help? > > > > Cheers, > > > > Doug. > >
"how to split a string in a random way"
Location for shared Access database Extract Single Record from Dataset filled from SP Output Creating text boxes on the fly? String manipulation question for each step order reverse direction ? single line string maninuplation substring, trim, indexof ? Installing .net assemblies windows installer Shared database without network tech required About Access Windows Service information |
|||||||||||||||||||||||