Groups | Blog | Home
all groups > vb.net > february 2004 >

vb.net : HOWTO: Use C# File (.cs) In VB.NET Solution


Dan Sikorsky
2/13/2004 10:17:02 PM
I've included a .cs file in my project that has all .aspx.vb and .vb files,
but can't dim a variable in a .vb file as a .c# class.
Dim objCard as DotNetNuke.CreditCardPurchase
this fails because CreditCardPurchase is not seen in namespace DotNetNuke

Here's the c# file:

namespace DotNetNuke

{

using System;

public class CreditCardPurchase

{

public string host;

public string store_id;

public string api_token;

public string order_id;

public string amount;

public string card;

public string exp;

public string crypt;



public void DoPurchase()

{

HttpsPostRequest mpgReq =

new HttpsPostRequest(host, store_id, api_token,

new Purchase(order_id, amount, card, exp,
crypt));





}



}

}



Where am I going wrong? How do you mix vb and c# files in the same project?

--
Dan Sikorsky, MSCS BSCE BAB


Scott M.
2/13/2004 11:06:39 PM
Keep the C# assembly separate from your VB project. Just make a reference
to the C# assembly and instantiate the C# class as you would any other
class.


[quoted text, click to view]

Rob Windsor [MVP]
2/13/2004 11:12:52 PM
Dan,

The easiest way is to put the C# code in a Class Library (DLL) project and
add that to your solution. The other way is to create a multi-file assembly
but that's a pain-in-the-ass and must be done outside Visual Studio.

Hope

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
this helps,

[quoted text, click to view]

hirf-spam-me-here NO[at]SPAM gmx.at
2/14/2004 1:43:18 PM
* "Dan Sikorsky" <dsikor@gte.net> scripsit:
[quoted text, click to view]

Create a C# class library project and reference this project from within
your other project/files.

--
Herfried K. Wagner [MVP]
Dan Sikorsky
2/14/2004 3:25:03 PM
Thanks, I'll try the dll thing.

--
Dan Sikorsky, MSCS BSCE BAB


[quoted text, click to view]

Dan Sikorsky
2/14/2004 3:25:25 PM
Thanks, I'll do that.

--
Dan Sikorsky, MSCS BSCE BAB


[quoted text, click to view]

Dan Sikorsky
2/14/2004 3:25:47 PM
Ok, thanks.

--
Dan Sikorsky, MSCS BSCE BAB


[quoted text, click to view]

AddThis Social Bookmark Button