473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

GUIDS not creating correctly in vb.net

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.

Nov 11 '06 #1
2 3248
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
<do**@dodeonline.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.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.

Nov 11 '06 #2
Thanks Tom - that worked a treat :)

Cheers,

Doug.
Tom Leylan wrote:
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
<do**@dodeonline.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.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.
Nov 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jon Perez | last post by:
Is there a Python function that works on all platforms (not just Win32) to generate such in the DCE / Microsoft format? If not present, this looks like it would be a very Pythonic addition to...
0
by: Shaun Clark | last post by:
Hello, I am trying to bring my entire organization from a Microsoft platform to a Linux one, starting with all of the servers we are currently running. Sun ONE ASP allows me to run ASP on Linux...
4
by: J.Marsch | last post by:
I notice that when I generate various guids, they appear to have a mix of upper and lowercase letters. Is the uniqueness of a guid case-sensitive? In other words, if I generate a guid, and...
1
by: vector | last post by:
I've got an application that generates GUIDs. A lot of GUIDs. Lots of GUIDs that end up in files on disk, taking up space. I'd like to continue using the Guid.NewGuid() function as my unique tag...
11
by: Jeff | last post by:
Hi - I'm experiencing a strange problem when comparing 2 guids. In my trial, they're not equal. When I step through the (VB.NET) code, they are evaluated as equal, and when I enter the...
2
by: Howard Kaikow | last post by:
Being lazy, I sometimes copy a project to another directory, then tweak the code. A problem arises because then both projects have identical GUIDs in the .sln file, and in the assembly file. ...
14
by: Chris Dunaway | last post by:
I have used Guid's as a unique identifier in data applications. But in a recent project, the length of the Guid's string is proving to be too long. Is there a method for generating a unique...
4
by: guy | last post by:
vb2005 webforms app in my app i have a guid (it is used as a primary key) when i debug the app if i hover over the guid, or look at it with quickwatch it always shows as being empty even though...
3
by: JT | last post by:
Hi, I am having trouble finding information about GUIDs and strong-names and don't really know what I need. If that's too ambiguous, please tell me where to look for info on these. Here's...
1
by: GHUM | last post by:
Hello, I created lots of guids via pywintypes.CreateGuid() on windows. Now I would like to run the same software on Linux / Solaris / FreeBSD. So I should produce "compatible" GUIDS on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.