Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with namespaces/references

Problem with namespaces/references

Scheduled Pinned Locked Moved C#
questionhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    methodincharge
    wrote on last edited by
    #1

    I have a solution that contains 4 projects. The main project is entitled Majo, which uses the Majo namespace IE: namespace Majo { public class Majo : System.Windows.Forms.Form { ... In the Components project I have the following declaration: namespace Majo { namespace Components { public class ImageComponent : PictureBox { .... The problem is I need to have access to the Majo class within the main Majo namespace, but if I just use Majo from the Components namespace, I get a 'Majo' denotes a 'namespace' where a 'class' was expected How can I gain access to the Majo class from Components? Thanks.

    C 1 Reply Last reply
    0
    • M methodincharge

      I have a solution that contains 4 projects. The main project is entitled Majo, which uses the Majo namespace IE: namespace Majo { public class Majo : System.Windows.Forms.Form { ... In the Components project I have the following declaration: namespace Majo { namespace Components { public class ImageComponent : PictureBox { .... The problem is I need to have access to the Majo class within the main Majo namespace, but if I just use Majo from the Components namespace, I get a 'Majo' denotes a 'namespace' where a 'class' was expected How can I gain access to the Majo class from Components? Thanks.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Majo.Majo majo = new Majo(); IMO you'd do better to change the namespace name, it's potentially confusing. Christian Graus - Microsoft MVP - C++

      M 1 Reply Last reply
      0
      • C Christian Graus

        Majo.Majo majo = new Majo(); IMO you'd do better to change the namespace name, it's potentially confusing. Christian Graus - Microsoft MVP - C++

        M Offline
        M Offline
        methodincharge
        wrote on last edited by
        #3

        I still get a The type or namespace name 'Majo' does not exist in the class or namespace 'Majo' (are you missing an assembly reference?) error if I attempt to use Majo.Majo. Is there someone I have to do to be able to reference the main class?

        C 1 Reply Last reply
        0
        • M methodincharge

          I still get a The type or namespace name 'Majo' does not exist in the class or namespace 'Majo' (are you missing an assembly reference?) error if I attempt to use Majo.Majo. Is there someone I have to do to be able to reference the main class?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          methodincharge wrote: Is there someone I have to do LOL - I assume this is a typo. I would still recommend changing the namespace name. Other than that, it's a strange problem, I'd expect it to work that out for you. Christian Graus - Microsoft MVP - C++

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups