Monday, March 26, 2012

mixed cs/vb question

I have a site wher ei'm using both cs and vb helper classes and it's working
ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).

However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?

Thanks!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes"WebBuilder451" <WebBuilder451@.discussions.microsoft.comwrote in message
news:0C0D3DD0-5C55-4A49-A253-8066C6899B67@.microsoft.com...

Quote:

Originally Posted by

I have a site wher ei'm using both cs and vb helper classes and it's


working

Quote:

Originally Posted by

ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).
>
However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?
>


Have you tried adding the microsoft.visualbasic.dll to a C# project?

BTW, despite you're preamble, why??

--
Anthony Jones - MVP ASP/ASP.NET
Assuming you have both C# and VB code in their own projects (in a solution,
likely):

1. Make the CS class and method both public
2. Add a project reference to the CS project from VB.NET project

And you all set to instantiate/access the C# class/method...

Hope this helps?

"WebBuilder451" wrote:

Quote:

Originally Posted by

I have a site wher ei'm using both cs and vb helper classes and it's working
ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).
>
However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?
>
Thanks!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
>
kes


If you really like c#, then simply consider translating the Vb.NET class to
c# and be done with it.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"WebBuilder451" wrote:

Quote:

Originally Posted by

I have a site wher ei'm using both cs and vb helper classes and it's working
ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).
>
However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?
>
Thanks!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
>
kes


actually i did that when i was learning cs because i got frustrated one day.
they are both in the same project and working ok i can instate a cs class in
a vb or cs page.
as to why? i didn't want ot rewrite 20 or 30 functions for simple CRUD
operations.

--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes

"Anthony Jones" wrote:

Quote:

Originally Posted by

"WebBuilder451" <WebBuilder451@.discussions.microsoft.comwrote in message
news:0C0D3DD0-5C55-4A49-A253-8066C6899B67@.microsoft.com...

Quote:

Originally Posted by

I have a site wher ei'm using both cs and vb helper classes and it's


working

Quote:

Originally Posted by

ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).

However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?


>
Have you tried adding the microsoft.visualbasic.dll to a C# project?
>
BTW, despite you're preamble, why??
>
--
Anthony Jones - MVP ASP/ASP.NET
>
>
>


yes i thought of that, believe it or not, will not help the other developers
working on the project, and it'd be work.
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes

"Peter Bromberg [C# MVP]" wrote:

Quote:

Originally Posted by

If you really like c#, then simply consider translating the Vb.NET class to
c# and be done with it.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
>
>
>
"WebBuilder451" wrote:
>

Quote:

Originally Posted by

I have a site wher ei'm using both cs and vb helper classes and it's working
ok (please the, "why would you want to do that" comment is unnecessay;
"stuff" happens and you need to play the hand you are delt).

However, i need to access some methods in a cs class from a vb class. Does
anyone know how to do this?

Thanks!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes

0 comments:

Post a Comment