Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7083511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:11:14+00:00 2026-05-28T07:11:14+00:00

In Visual Studio 10 – Visual Basic, why can’t I import System.Drawing when my

  • 0

In Visual Studio 10 – Visual Basic, why can’t I import “System.Drawing” when my only reference is “System”? I can import “System.Runtime.InteropServices”.

To reproduce my problem:
1. Create a New Project in Visual Studio 10 with Visual Basic Class Library template.
2. Add “Imports System.Drawing” and “Imports System.Runtime.InteropServices” at the beginning.
3. Remove all references except “System” in the References pane of the project properties.

Result:
Visual Studio cannot find “System.Drawing” but it can find “System.Runtime.InteropServices”. “System.Drawing” is fully qualified so the system should be able to find it inside the referenced “System”.

Thoughts:
It appears “System” and “System.Drawing” are distinct namespaces (or containers?) so why doesn’t qualification “.” work? Does “.” represent something else?

“System” is also in “mscorlib” but is that the namespace which is used or is it another?

“Microsoft.VisualBasic” is also listed in the imported namespaces but there is not a reference to it. How was it found? Where is the “Imported namespaces” list populated from?

A link to any related info from the MSDN library would definitely be helpful. I have been looking through it for a while but cannot understand why “System.Drawing” is not imported.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:11:15+00:00Added an answer on May 28, 2026 at 7:11 am

    The .NET Common Language Infrastructure has two distinct concepts:

    • Namespaces: Prefixes for type names such as System.Drawing, which are used to distinguish multiple types which would otherwise have the same name.
    • Assemblies: Libraries of code which can be deployed, installed, and versioned separately from other assemblies. The types in an assembly may be in any number of namespaces.

    Namespaces form a hierarchy based on full-stop (dot) separators – so you are meant to think that the types in the System.Runtime.InteropServices namespace are subordinate to the ones in the System.Runtime namespace. However, as far as I know, the CLI does not care about the name or hierarchy of your namespaces, except insofar as they make your type names unique.

    Furthermore, an assembly can contain types from multiple namespaces, even ones in different hierarchies, and a single namespace can contain types defined in multiple assemblies. If you look at the MSDN documentation for a type in the .NET libraries, it will tell you what assembly that type is in. However, as Paolo Falabella has pointed out, MSDN will not tell you what assembly a namespace is in, because a single namespace can contain types from multiple assemblies.

    In your scenario: mscorlib is an assembly that defines some types in the System namespace and many others, such as System.Runtime.InteropServices, as you noted. However, the types you are using in the System.Drawing namespace are located in the System.Drawing assembly.

    Because assemblies are the unit of code deployment and reuse, Visual Studio projects reference assemblies, not namespaces, and so you must add a reference to the System.Drawing assembly in the Visual Studio project for your program.

    The VB.NET Imports statement (and its C# equivalent, the using directive) let you refer to types in a namespace without having to type out the namespace name every time. That is, with Imports System.Drawing, you can write Graphics in your code instead of System.Drawing.Graphics. But that is all the Imports statement does. In particular:

    • Imports System does not automatically create project references to every assembly in the world that happens to define types in the System namespace.
    • Imports mscorlib does not mean you reference every type in the “mscorlib” assembly by its short name. It means you can reference types in the “mscorlib” namespace by their short names, which is not only entirely different but very unlikely to be what you want.

    Bottom line: if you want access to GDI+, then you use the types in the System.Drawing namespace, but that name has nothing to do with the GDI+ assembly’s name. Microsoft chose the name “System.Drawing” for the assembly that contains GDI+ types, but it could have chosen “gdiplus-cli”, “gdi-for-dotnet”, or even “Frobinator”. Whatever name that assembly has, you have to add a reference to that assembly. And you don’t do that in your source code – you add assembly references in your Visual Studio project configuration.

    MSDN has an outdated but still good description of assemblies, namespaces, and the differences between them, which you may find helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Visual Studio Test can check for expected exceptions using the ExpectedException attribute. You can
Visual studio can print call stack when breakpoint hit, and can stop when conditions
Visual Studio 2010 seems to insist on having this import in web application projects
Visual Studio 2008 supports CSS 1.0, 2.0 and 2.1 only. If I try to
Visual Studio has a way to import, export your color settings. Does Eclipse have
Visual Studio Team System and Team Foundation Server offers a lot of goodies like
Visual Studio 2010 doesn't display debug info for local variables. I have no problem
Visual Studio's auto complete feature is extremely useful but can also be extremely irritating
Visual Studio 2008 can load a solution upon startup. Can it also run it
Visual Studio 2010 .NET 3.5 Is there any tool that can trace the http

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.