|
-
May 15th, 2021, 03:13 AM
#1
Thread Starter
New Member
[RESOLVED] Adding a Reference to a Library class in VB Net (Foundation)
I have added a reference to System.Drawing in my library class and it will now accept a System.Drawing.Point object in my code, but it will not accept a System.Drawing.Color object, nor can I find another place that I might need to add to my References. When I do this I get a BC30002 - Type System.Drawing.Color is not defined error. How do I deal with this error? Thanks.
-
May 15th, 2021, 04:08 AM
#2
Re: Adding a Reference to a Library class in VB Net (Foundation)
Is your project targeting .NET Framework or .NET Core and which version? Note that .NET 5.0 is .NET Core. EXACTLY what steps did you follow to add the reference and did you also import the namespace?
-
May 15th, 2021, 06:44 AM
#3
Thread Starter
New Member
Re: Adding a Reference to a Library class in VB Net (Foundation)
I created the library using Version 16.9.4 as a .NET Framewok Library class. I am now using version 16.9.5. To add the Reference, I clicked on References in Solution Explorer and a window appeared that showed a long list of possible references. I found System.Drawing in this list, clicked on the box opposite this and closed the window. I checked that System.Drawing appeared in the list of references for the application. I have also looked at Project->add a reference, and the same list appears, with the box checked. I have Imports System.Drawing at the head on my code for this class.
-
May 15th, 2021, 08:09 AM
#4
Re: Adding a Reference to a Library class in VB Net (Foundation)
 Originally Posted by KeithMcCloy
I created the library using Version 16.9.4 as a .NET Framewok Library class. I am now using version 16.9.5. To add the Reference, I clicked on References in Solution Explorer and a window appeared that showed a long list of possible references. I found System.Drawing in this list, clicked on the box opposite this and closed the window. I checked that System.Drawing appeared in the list of references for the application. I have also looked at Project->add a reference, and the same list appears, with the box checked. I have Imports System.Drawing at the head on my code for this class.
That all sounds in order. I just did the same thing and and it all worked for me.
-
May 15th, 2021, 08:12 AM
#5
Re: Adding a Reference to a Library class in VB Net (Foundation)
 Originally Posted by KeithMcCloy
When I do this I get a BC30002 - Type System.Drawing.Color is not defined error. How do I deal with this error? Thanks.
You say that you have imported the namespace but the error message is specifying the fully-qualified name. The whole point of importing the namespace is so that you don't have to qualify the name. Either import the namespace and use the type name unqualified or don't import the namespace and qualify the type name. The System namespace is imported by default at the project level, so you never have to include that in the qualifier. The only reason to break these rules is generally if you need to disambiguate multiple types with the same name, but that is something you should avoid in the first place if you possibly can.
-
May 16th, 2021, 02:28 AM
#6
Thread Starter
New Member
Re: Adding a Reference to a Library class in VB Net (Foundation)
Aha!!, Now I am starting to understand some of this stuff. Followed your advice, JMc and it got rid of my error, Thank You very much
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|