473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Nov 20 '05 #1
6 11598
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" <ds****@gte.net> wrote in message
news:ur**************@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

Nov 20 '05 #2
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" <ds****@gte.net> wrote in message
news:ur**************@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

Nov 20 '05 #3
* "Dan Sikorsky" <ds****@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>
Nov 20 '05 #4
Thanks, I'll do that.

--
Dan Sikorsky, MSCS BSCE BAB
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:%2****************@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" <ds****@gte.net> wrote in message
news:ur**************@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


Nov 20 '05 #5
Thanks, I'll try the dll thing.

--
Dan Sikorsky, MSCS BSCE BAB
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:e7**************@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" <ds****@gte.net> wrote in message
news:ur**************@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


Nov 20 '05 #6
Ok, thanks.

--
Dan Sikorsky, MSCS BSCE BAB
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ei**************@TK2MSFTNGP10.phx.gbl...
* "Dan Sikorsky" <ds****@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>

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: gabor | last post by:
hi, what i want to achieve: i have a cgi file, that writes an entry to a text-file.. like a log entry (when was it invoked, when did his worke end). it's one line of text. the problem is:...
4
by: Mark Goldin | last post by:
I am trying to implement a printing to file solution of a html page on the server. What I have is a form with a IE control that loads the page I want to print to. I am using execWB command for...
2
by: Connected | last post by:
Hi, Using VS.NET 2003, I would like to deploy my project as a single-file exe. What I actually get is three files: Setup.exe Setup.ini MyProg.msi
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
4
by: Edward Diener | last post by:
If I set an Xml documentation file in Configuration Properties | Build, a warning is put out for every non-private element in a public class in every file of my assembly when there is no Xml...
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
4
by: Mark | last post by:
So, I've got some PHP code that reads in a file and parses some data as it goes along. However, now I'm thinking it might be easier for me to store chunks of the file in the database rather than...
0
blyxx86
by: blyxx86 | last post by:
I'm getting this error message when I try to open one of the 'front end' files I have, and also when I try to open the 'back end' file from certain computers. I can do it from my station here, and...
1
by: dwaterpolo | last post by:
Hi Everyone, I am trying to read two text files swY40p10t3ctw45.col.txt and solution.txt and compare them, the first text file has a bunch of values listed like: y y y y y y y
16
by: =?Utf-8?B?RHdlZWJlcmVsbGE=?= | last post by:
I created an Access 2007 application for my customer. The application is shared by three employees on a server. It maintains a contact list including financial data and social security numbers. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.