Namespces in VB

  • Thread starter Thread starter cmay
  • Start date Start date
C

cmay

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 "RotatorDesigner" class.


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


using System;
using ComponentArt.Web.UI.Design;


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


public Class1()
{
}
}

}


namespace ComponentArt.Web.UI.Design
{
public class MyTestClass
{
public MyTestClass()
{

}
}
}
 
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)
 
Back
Top