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
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] "Dan Sikorsky" <dsikor@gte.net> wrote in message news:ur0Ojjq8DHA.3008@TK2MSFTNGP09.phx.gbl... > 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 > > >
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] "Dan Sikorsky" <dsikor@gte.net> wrote in message news:ur0Ojjq8DHA.3008@TK2MSFTNGP09.phx.gbl... > 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 > > >
* "Dan Sikorsky" <dsikor@gte.net> scripsit: [quoted text, click to view] > 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.
Create a C# class library project and reference this project from within your other project/files. -- Herfried K. Wagner [MVP]
Thanks, I'll try the dll thing. -- Dan Sikorsky, MSCS BSCE BAB [quoted text, click to view] "Rob Windsor [MVP]" <rwindsor@NO.MORE.SPAM.bigfoot.com> wrote in message news:e7ewZDr8DHA.2752@TK2MSFTNGP09.phx.gbl... > 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, > > "Dan Sikorsky" <dsikor@gte.net> wrote in message > news:ur0Ojjq8DHA.3008@TK2MSFTNGP09.phx.gbl... > > 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 > > > > > > > >
Thanks, I'll do that. -- Dan Sikorsky, MSCS BSCE BAB [quoted text, click to view] "Scott M." <s-mar@BADSPAMsnet.net> wrote in message news:%23JpZGAr8DHA.3200@TK2MSFTNGP09.phx.gbl... > 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. > > > "Dan Sikorsky" <dsikor@gte.net> wrote in message > news:ur0Ojjq8DHA.3008@TK2MSFTNGP09.phx.gbl... > > 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 > > > > > > > >
Ok, thanks. -- Dan Sikorsky, MSCS BSCE BAB [quoted text, click to view] "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:eiDcNhv8DHA.2472@TK2MSFTNGP10.phx.gbl... > * "Dan Sikorsky" <dsikor@gte.net> scripsit: > > 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. > > Create a C# class library project and reference this project from within > your other project/files. > > -- > Herfried K. Wagner [MVP] > < http://www.mvps.org/dotnet>
Don't see what you're looking for? Try a search.
|