how do u call a vb.net form in c#

  • Thread starter Thread starter Shaggyh
  • Start date Start date
S

Shaggyh

hi
im having trouble wondering can anyone help
i have created a vb.net form in visual studio 2003
i would like to create a driver class to call this form in csharp
im having trouble finding the right code
to do this..
does any one have any idea if this is possible and point me in the right
direction

if any one has an idea feel free to pass on ur wisdom

thanks


newbie - shaggy
 
hi
im having trouble wondering can anyone help
i have created a vb.net form in visual studio 2003
i would like to create a driver class to call this form in csharp
im having trouble finding the right code
to do this..
does any one have any idea if this is possible and point me in the right
direction

if any one has an idea feel free to pass on ur wisdom

I'm not being nasty here, but why not just make the form
in C#?
 
Newbie - add the .dll reference, and then just make sure you fully qualify
the Namespace and class- there's nothing special other than that.
 
Bob - probably because it's already written in VB.NET and as much as I don't
like VB.NET - there's no need to rewrite it. Wouldn't you agree?
 
so im callin for example code like this
below ??


using System;


public class driver
{
private static void Main()
{
smsfrm n = new smsfrm();
n.intialize();

}
}

where smsfrm is my vb.net form....
im not sure that n.intialize() is right?
and then making the vb form appear on screen..
i hope im making some scence here..
now i can do all the csc /target:library stuff with c# programs
but i dont no how to cross call them.. or bundle them properly.
the vb.net file is referencing another dll file for a webservice i made.
so the vb form calls that dll.. but i need a c# file to call the vb form..
as a driver class to run it...

well i hope im making scense

what way do i reference it? r what should i do next..

thanks 4 replys

regards

newbie-shaggy
 
Bob - probably because it's already written in VB.NET and as much as I
don't
like VB.NET - there's no need to rewrite it. Wouldn't you agree?

Wellllll - no. I don't like having mixed stuff in my code. When I did VB6 I
did VB6. When I did Delphi I did Delphi. When I went to C#, I do C#.
Just my opinion - sorry.
 
Essentially, you can mix and matc C# and VB.net code, but there is a trick.
All the VB.net code must be in a separate project from the C# code. Then
you can simply add both projects to one solution and access the VB.NET code
as you would a normal C# class.

I had a recent need to use optional arguments for a project, and this was
the only way to achieve what I needed to do.
 
You could have used the params feature of C#, but this isn't type-safe if
you have different types of parameters to pass.

--Liam.
 
Back
Top