Integrating VB.net forms into C#

G

Guest

I have a question about functionality I was wondering if anyone ever tried.
Here is my problem/question. I'm currently in the motions of learning C# with
that said I created a windows application which has a parent form. I have
several small data eccentric applications in VB that I would like to
implement in C# but I don't want to go back and recreate all the forms and
recode.

Is there a way for me to add the VB forms into the C# mdiParent form. I
don't mind placing in the code for launching the forms I just don't wanna go
back and re-write or create all of the forms from scratch. Can I make the Vb
forms dll's and implement them that way? Has anyone ever tried this? Thanks.
 
R

RobinS

I doubt it. I had trouble even copying and pasting code from VB2005 to C#.
Some lines didn't work even though they were identical, but then when I
typed the same darned thing on the next line, it did work. I mean the same
exact darn thing.

Robin S.
 
R

RobinS

Oh, one thing you *can* try is opening the form in design mode in VB, then
select all the controls and hit Ctrl-C to copy them. Then open a form in
design mode in C#, and hit Ctrl-V to paste them in. It won't give you the
code behind, but at least you won't have to recreate the forms. I'm not
100% sure it will work, but I'd be surprised if it didn't.

Robin S.
---------------------------
 
G

Guest

Thanks for your help. I may have found a way. If I create the form as a user
control I can apply the entire user control to a form in C#. I tested this
earlier. I created a user control with a text field and buttons. Behind the
button I placed a simple message box. By the way, since it's a user control I
had to type out the entire syntax for the message box which was
System.Windows.Forms.Messagebox. Anyhow, I applied the user control a form in
C# and it worked. When I clicked the button the Messagebox showed up. I'm
going to have to experiment some more.

I figured it was possible since the languages are suppose to be integrated.
Anyhow, if anyone has any more suggestions then let me know.
 
R

RobinS

Geez, having the whole thing be a user control adds a level of complexity
to it that I wouldn't want to deal with. I'm still voting for the copy &
paste method... ;-)

Robin S.
-------------------------
Terrance said:
Thanks for your help. I may have found a way. If I create the form as a
user
control I can apply the entire user control to a form in C#. I tested
this
earlier. I created a user control with a text field and buttons. Behind
the
button I placed a simple message box. By the way, since it's a user
control I
had to type out the entire syntax for the message box which was
System.Windows.Forms.Messagebox. Anyhow, I applied the user control a
form in
C# and it worked. When I clicked the button the Messagebox showed up. I'm
going to have to experiment some more.

I figured it was possible since the languages are suppose to be
integrated.
Anyhow, if anyone has any more suggestions then let me know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top