473,803 Members | 3,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1858
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*@discussion s.microsoft.com > wrote in message
news:4E******** *************** ***********@mic rosoft.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*@discussion s.microsoft.com > wrote in message
news:4E******** *************** ***********@mic rosoft.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*@discussion s.microsoft.com > wrote in message
news:4E******** *************** ***********@mic rosoft.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
3498
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, Alexandre
6
4910
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 user might expect because the file iterator buffered data and readline did not read from that buffer. Hence the call to readline might unexpectedly skip some lines.
0
1830
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 protocol argument for each time it's called. (This is in Python 2.3.3.) I have a pickle containing two objects: a tag string and a (large) object containing many children. The identifying string is there so that you can unpickle it and...
4
23692
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
3423
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 would like to open C++ file streams due to easier exception handeling and safe closure of file ressources. Question 1: I open a standard file stream and want to transfer some binary read bits
4
1939
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 pattern in this case? C++ allows for a better design, but integrating the code with the C code isn't straight forward, it becomes rather messy. Code readability and maintenance are important, since the project will grow in the future. Maybe someone...
2
2421
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 anyway to get to both use the same one? For example i want to convert my homepage to aspx first, but in doing so my session var that needs to be initialised wont be as it will use the global.asax and not the global.asa.
0
1265
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 haven't tried is mixing ASP.NET 1.1 & ASP.NET 2.0 pages in the same website/application but each page in different iframes. I don't think it's possible to to have both ASP.NET 1.1 & 2.0 pages in
28
3107
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 applications, I decide to write it in C instead of C++. However, I thought it might be convenient to use some C++ code at some misc places. I'm aware that, I could always use the C++ compiler to get it work.
3
2101
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 where I've been asked to create a few new pages on an exsisting website. The website is written in vb.net with vb.net codebehind and classes. My employer says I can use C# for new stuff If I want.
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.