VB.NET component

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a C# windows app and i need to use a VB.NET component to talk to
several servers.
Can i use the VB.NET component with my C# application?

thx
 
Mike,

Yes, you can. VB.NET compiles to IL, just like C# does. This means
that if you develop an assembly in VB.NET, you can easily reference it in
C#. All you have to do is set a reference and you should be set.

Hope this helps.
 
when i do that though i"m getting a namespace error, But I can reference
this same DLL in a VB.NET application
I have this in the begining of the code with all the other using
statements.

using LookAtTable.TableViewer;

and when i compile it i get

A using namespace directive can only be applied to namespaces
'LookAtTable.TableViewer' is a class not a namespace.

do i not use the USING statement with this like i use the import statement
in VB.NET?




Nicholas Paldino said:
Mike,

Yes, you can. VB.NET compiles to IL, just like C# does. This means
that if you develop an assembly in VB.NET, you can easily reference it in
C#. All you have to do is set a reference and you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
I have a C# windows app and i need to use a VB.NET component to talk to
several servers.
Can i use the VB.NET component with my C# application?

thx
 
Mike,

TableViewer looks like a class. Just do:

using LookAtTable;

And it should work. You want to use the using statement for the
namespace that the classes are in, not the class itself (although you can
alias a class name, if you want).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
when i do that though i"m getting a namespace error, But I can reference
this same DLL in a VB.NET application
I have this in the begining of the code with all the other using
statements.

using LookAtTable.TableViewer;

and when i compile it i get

A using namespace directive can only be applied to namespaces
'LookAtTable.TableViewer' is a class not a namespace.

do i not use the USING statement with this like i use the import statement
in VB.NET?




message news:[email protected]...
Mike,

Yes, you can. VB.NET compiles to IL, just like C# does. This means
that if you develop an assembly in VB.NET, you can easily reference it in
C#. All you have to do is set a reference and you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
I have a C# windows app and i need to use a VB.NET component to talk to
several servers.
Can i use the VB.NET component with my C# application?

thx
 
thanks that helped.

I'm in the process of learning C# and while converting a VB.NET app to C#
So i'll be asking alot of questions


Nicholas Paldino said:
Mike,

TableViewer looks like a class. Just do:

using LookAtTable;

And it should work. You want to use the using statement for the
namespace that the classes are in, not the class itself (although you can
alias a class name, if you want).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
when i do that though i"m getting a namespace error, But I can reference
this same DLL in a VB.NET application
I have this in the begining of the code with all the other using
statements.

using LookAtTable.TableViewer;

and when i compile it i get

A using namespace directive can only be applied to namespaces
'LookAtTable.TableViewer' is a class not a namespace.

do i not use the USING statement with this like i use the import statement
in VB.NET?




message news:[email protected]...
Mike,

Yes, you can. VB.NET compiles to IL, just like C# does. This means
that if you develop an assembly in VB.NET, you can easily reference it in
C#. All you have to do is set a reference and you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have a C# windows app and i need to use a VB.NET component to talk to
several servers.
Can i use the VB.NET component with my C# application?

thx
 
Namespaces can be tricky...

lets say you have two namespaces:

my.namespace.a;
my.namespace.a.b;

Lets say you have a function in that has a parameter or return value
that of a type that belongs to [a]. When you consume it, you'll have to
import both namespaces. This one has come back to bite me in more ways than
one before I realized the problem and the solution. Just import all the
relevant namespaces. There is a possibility (though I'm not sure because I
don't understand the problem) that this could be the case.


Thanks,
Shawn

www.zenofdotnet.com
Coming soon





Mike said:
thanks that helped.

I'm in the process of learning C# and while converting a VB.NET app to C#
So i'll be asking alot of questions


message news:[email protected]...
Mike,

TableViewer looks like a class. Just do:

using LookAtTable;

And it should work. You want to use the using statement for the
namespace that the classes are in, not the class itself (although you can
alias a class name, if you want).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
when i do that though i"m getting a namespace error, But I can reference
this same DLL in a VB.NET application
I have this in the begining of the code with all the other using
statements.

using LookAtTable.TableViewer;

and when i compile it i get

A using namespace directive can only be applied to namespaces
'LookAtTable.TableViewer' is a class not a namespace.

do i not use the USING statement with this like i use the import statement
in VB.NET?




"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
wrote
in
message Mike,

Yes, you can. VB.NET compiles to IL, just like C# does. This means
that if you develop an assembly in VB.NET, you can easily reference
it
in
C#. All you have to do is set a reference and you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have a C# windows app and i need to use a VB.NET component to
talk
to
several servers.
Can i use the VB.NET component with my C# application?

thx
 
Yes! Just add a reference to the VB.NET component and everything will just
work.

-Joel
--------------------
 
Back
Top