473,327 Members | 2,094 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,327 software developers and data experts.

Mixing VB and C#?

Tim
I've heard it's possible to write multi-language programs, but can't find any examples of this. I'd like to write a program where the gui is in VB but the non-form classes are written in C#. Is there an example or tutorial on how to write an application which mix VB and C#?

Thanks
[Tim]

Jul 21 '05 #1
3 1831
Create a new solution project in either langauge - for the sake of
illustration, use VB.NEt. Now, Go to file - Add and select New Project.
Make sure you use Add and not Open. Then select C# and the Class Library or
whichever template you want. Then, go back to the VB Project (they are both
in the same solution) and select Add Reference. on the third tab of Add
Reference (after .NET and COM) you can select the C# project. That's pretty
much all there is to it. If you add the project then VS.NEt will establish
a default build order for you.

Let me know if you have any questions.

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
I've heard it's possible to write multi-language programs, but can't find any examples of this. I'd like to write a program where the gui is in VB
but the non-form classes are written in C#. Is there an example or tutorial
on how to write an application which mix VB and C#?
Thanks
[Tim]

Jul 21 '05 #2
Hi Tim,

William described one way that is supported by VS.NET (IDE).
But there is more - .net allows you to mix languages even in same assembly
(which isn't supported by IDE).
To see a sample check framework sdk sample - if I remember there is at least
one.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
I've heard it's possible to write multi-language programs, but can't find any examples of this. I'd like to write a program where the gui is in VB
but the non-form classes are written in C#. Is there an example or tutorial
on how to write an application which mix VB and C#?
Thanks
[Tim]

Jul 21 '05 #3
Tim
Thank you, this did work. What I wasn't doing was adding the reference to the VB project. I was hoping there was a way of doing this all within the IDE, otherwise the mixed language feature would lose much of it's luster.

[Tim]

"William Ryan eMVP" wrote:
Create a new solution project in either langauge - for the sake of
illustration, use VB.NEt. Now, Go to file - Add and select New Project.
Make sure you use Add and not Open. Then select C# and the Class Library or
whichever template you want. Then, go back to the VB Project (they are both
in the same solution) and select Add Reference. on the third tab of Add
Reference (after .NET and COM) you can select the C# project. That's pretty
much all there is to it. If you add the project then VS.NEt will establish
a default build order for you.

Let me know if you have any questions.

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
I've heard it's possible to write multi-language programs, but can't find

any examples of this. I'd like to write a program where the gui is in VB
but the non-form classes are written in C#. Is there an example or tutorial
on how to write an application which mix VB and C#?

Thanks
[Tim]


Jul 21 '05 #4

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

Similar topics

3
by: bergel | last post by:
Hello, Does anyone already have some experience in mixing AWT and Swing? Is it conceptually doable? Does the design of Swing prevent interaction between an AWT and a Swing widget? Regards,...
6
by: Russell E. Owen | last post by:
At one time, mixing for x in file and readline was dangerous. For example: for line in file: # read some lines from a file, then break nextline = readline() # bad would not do what a naive...
0
by: Erik Max Francis | last post by:
Is there any prohibition against mixing different protocols within the same pickle? I don't see anything about this in the Python Library Reference and, after all, the pickle.dump function takes a...
4
by: Rudolf | last post by:
Is it possible to add a vb.net source code module to a c# project and if so how? Thanks Rudolf
1
by: Marc Cromme | last post by:
I would like to ask a question about (good ?) style and possibilities in mixing C FILE* and C++ file streams. The background is that I want to use the C libpng library from within C++, but I...
4
by: Cristian Tota | last post by:
Hi, I'd appreciate any thoughts on mixing C++ and C code. I have a project that uses a given C interface, the rest of the project can be either in C or C++. What would be the recomended design...
2
by: Dan | last post by:
Hi What are the dangers of mixing asp and asp.net? For the .net part of the site i will need to use the global.asax file but for the asp parts it will be using the other global. file, is there...
0
by: dhruba.bandopadhyay | last post by:
I know that it's possible to mix ASP & ASP.NET 1.1 in the same website/application so long as they are in separate frames (iframes). This also holds for mixing ASP & ASP.NET 2.0 pages. But what I...
28
by: ziman137 | last post by:
Hello all, I have a question and am seeking for some advice. I am currently working to implement an algorithmic library. Because the performance is the most important factor in later...
3
by: jason | last post by:
I've been working with C# for over a year now without touching vb.net code. I had a few light years of vb.net before that. No real vb6 or windows form experience. Suddenly, I have an assignment...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.