473,728 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Guid not working?

Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xx x-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie
Nov 16 '05 #1
3 10132
Hi Razzie,

You are actually applying an atttribute to someClass. When you do so, the
attribute name you use actually refers to an Attribute type. In your case,
you are really referring to the GuidAttribute attribute type which exists in
the System.Runtime. InteropServices namespace. Add a using statement for this
namespace in your source file.

HTH,
Rakesh
"Razzie" wrote:
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xx x-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #2
GuidAttribute is in System.Runtime. InteropServices namespace. So, have
'using System.Runtime. InteropServices ;' in your code.

"Razzie" <ra****@quickne t.nl> wrote in message
news:Ou******** *****@TK2MSFTNG P12.phx.gbl...
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xx x-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #3
Thnx both replyers!

"Razzie" <ra****@quickne t.nl> wrote in message
news:Ou******** *****@TK2MSFTNG P12.phx.gbl...
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm
the only one having troubles with it. I'm using the System namespace in
which the Guid class is, but even if I use [System.Guid("xx x-etc")] it's
not working. Am I doing something wrong? And I don't have the 'Create
Guid' in the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #4

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

Similar topics

6
2749
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid = server.createobject("scriptlet.typelib").guid guid=Left(guid,instr(guid,"}")) genguid=guid
24
10884
by: Ilija_G | last post by:
Hi, Is there any replace for "Select @@identity" that could return "just inserted" GUID as a primary key? Has anyone tested what's faster, working with Guid or Autonumber ?
0
270
by: Doug | last post by:
I am working on an existing .NET (C Sharp) component that had a com interface that was used by a VB component. When it was originally written, it had the SSEAssemblyCom class below - minus the two last methods (for space I modified method names in my example below). I added those. Everything but the two new methods I added referenced the ISSEAssemblyCom interface below. I was told I would need to create a secondary interface...
3
13272
by: Jeffry van de Vuurst | last post by:
Hi, I'm working with Guids as the primary key of some of my tables. In my code, I'm working with those Guids. Now I was wondering what is the best way to work with Guids (in terms of performance, memory usage, etc)? Should I use the datatype Guid or should I convert them to strings and then just work with the string representation? The majority of the processing I do with these Guids is comparing a Guid with another Guid. Right now, I...
2
3921
by: Nadav | last post by:
Hi, I am using the System.Type.GUID to identify similar types on different computers, one computer send the GUID through a socket while the other resolve the GUID and identify the type, when working on a single computer everything works fine, BUT, when working on two different computers the GUID extracted from one type is different from the GUID extracted from the same type on the other computer. why is that happening? shouldn't a guid...
6
3062
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub directory for each request so as to get rid of any file concurrency issue, e.g c:\working\unique-identifier1 for Request #1 c:\working\unique-identifier1 for Request #2
2
3042
by: Lee Crabtree | last post by:
I've been wrapping an unmanaged class, and everything has gone well. That is...until now. I've hit a wall while trying to marshal the System::Guid type down into the unmanaged GUID structure that the unmanaged class asks for. For some reason, none of my attempts to date have met with success. Maybe someone else has an idea how this works? Lee
1
9134
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval ListNumber
1
3068
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval ListNumber
0
8896
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9192
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6012
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3231
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.