.NET 2.0 and VB

  • Thread starter Thread starter Chuck Douglas
  • Start date Start date
C

Chuck Douglas

I have a VB assembly which contains a web control
(System.Web.UI.WebControls). I am using Visual Studio 2005 and I am
compiling with the .NET 2.0 compiler (VC++ 8.0). This project has a
reference to a C# assemby, which has a netmodule linked into it. This other
managed C++ code contains a type called UNIT. My VB code contains a line,
such as below, which makes reference to the Width property on
System.Web.UI.WebControls.WebControl, which returns a type called
System.Web.UI.WebControls.Unit. However, since VB is not case sensitive, it
gives me an error at compile time, saying that type UNIT is not accessible
because it is private (for the line below). It seems to be finding the UNIT
type in the netmodule, before the Unit type in System.Web.UI.WebControls.

Public Overrides Property Width() As Unit

Is there any way to make VB look in a certain order for the references? Or,
can I suppress the UNIT type in my managed C++ code, using some directive
such as a pragma?

Any help would be appreciated.

Thanks
Chuck
 
I have a VB assembly which contains a web control
(System.Web.UI.WebControls). I am using Visual Studio 2005 and I am
compiling with the .NET 2.0 compiler (VC++ 8.0). This project has a
reference to a C# assemby, which has a netmodule linked into it. This
other managed C++ code contains a type called UNIT. My VB code
contains a line, such as below, which makes reference to the Width
property on System.Web.UI.WebControls.WebControl, which returns a type
called System.Web.UI.WebControls.Unit. However, since VB is not case
sensitive, it gives me an error at compile time, saying that type UNIT
is not accessible because it is private (for the line below). It
seems to be finding the UNIT type in the netmodule, before the Unit
type in System.Web.UI.WebControls.

Public Overrides Property Width() As Unit

Is there any way to make VB look in a certain order for the
references? Or, can I suppress the UNIT type in my managed C++ code,
using some directive such as a pragma?

You need to specify a (posibly partial ) namespace

for example you could say#
 
Rory,

Thanks for the reply. Unfortunately, that does not work for me. When I
specify the whole qualified namespace, the compiler then complains that the
overriden method in my code does not have the same return type, as the
method on the base class (WebControl.Width).

System.Web.UI.WebControls.Unit vs. Unit

It seems very determined to treat Unit and UNIT. Very strange.

Thanks
Chuck
 
Chuck Douglas said:
I have a VB assembly which contains a web control
(System.Web.UI.WebControls). I am using Visual Studio 2005 and I am
compiling with the .NET 2.0 compiler (VC++ 8.0). This project has a
reference to a C# assemby, which has a netmodule linked into it. This
other
managed C++ code contains a type called UNIT. My VB code contains a line,
such as below, which makes reference to the Width property on
System.Web.UI.WebControls.WebControl, which returns a type called
System.Web.UI.WebControls.Unit. However, since VB is not case sensitive,
it
gives me an error at compile time, saying that type UNIT is not accessible
because it is private (for the line below). It seems to be finding the
UNIT
type in the netmodule, before the Unit type in System.Web.UI.WebControls.

Public Overrides Property Width() As Unit

Is there any way to make VB look in a certain order for the references?
Or,
can I suppress the UNIT type in my managed C++ code, using some directive
such as a pragma?

Any help would be appreciated.

Thanks
Chuck

Chuck,

Try changing your code to use something like this:

Public Overrides Property Width() As System.Web.UI.WebControls.Unit

Stan
 
Back
Top