Namespces in VB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmay

    #1

    Namespces in VB

    I recently went to create a class that would be place inside the same
    namespace as an assembly I was referencing.

    This works ok in C#, but not in VB.net?

    What I mean is this code does NOT work in VB.NET. It will not compile
    b/c it can't find the "RotatorDesigne r" class.


    Is this a known thing that VB.Net can't do?


    using System;
    using ComponentArt.We b.UI.Design;


    namespace ClassLibrary1
    {
    public class Class1
    {
    ComponentArt.We b.UI.Design.Rot ­atorDesigner X;
    ComponentArt.We b.UI.Design.MyT ­estClass Y;


    public Class1()
    {
    }
    }

    }


    namespace ComponentArt.We b.UI.Design
    {
    public class MyTestClass
    {
    public MyTestClass()
    {

    }
    }
    }

  • Stenis

    #2
    RE: Namespces in VB

    Without knowing the specific error messages you get, I can't tell for sure,
    but it sounds like you are being bit by how the RootNamespace works in Visual
    Studio when using VB.NET projects.

    In C#, the namespace that you specify in your code is exactly the namespace
    that the compiler will put the generated types in. In Visual Basic, the root
    namespace for the project will be prepended to whatever namespace you specify
    in the code.

    Could you try to set your root namespace to an empty string and see if
    things work more like you expect? If it still doesn't work, please give us
    some more info on exactly what error message your see, and I'm sure we'll be
    able to come up with a solution for 'ya.

    Best regards,
    Johan Stenberg (MSFT Visual Basic)

    "cmay" wrote:
    [color=blue]
    > I recently went to create a class that would be place inside the same
    > namespace as an assembly I was referencing.
    >
    > This works ok in C#, but not in VB.net?
    >
    > What I mean is this code does NOT work in VB.NET. It will not compile
    > b/c it can't find the "RotatorDesigne r" class.
    >
    >
    > Is this a known thing that VB.Net can't do?
    >
    >
    > using System;
    > using ComponentArt.We b.UI.Design;
    >
    >
    > namespace ClassLibrary1
    > {
    > public class Class1
    > {
    > ComponentArt.We b.UI.Design.Rot ­atorDesigner X;
    > ComponentArt.We b.UI.Design.MyT ­estClass Y;
    >
    >
    > public Class1()
    > {
    > }
    > }
    >
    > }
    >
    >
    > namespace ComponentArt.We b.UI.Design
    > {
    > public class MyTestClass
    > {
    > public MyTestClass()
    > {
    >
    > }
    > }
    > }
    >
    >[/color]

    Comment

    Working...