Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Errors calling vb.net exe from vb6 form button

Status
Not open for further replies.

SJG0526

Programmer
Jul 5, 2002
108
0
0
US
I want to run a vb.net exe from a vb6 form's button. The vb.net exe must receive some passed parameters. I'm using the shell command. Sometimes this works, sometimes I get all kinds of different errors/exceptions. Can anyone tell me the correct way to do this?

Thank you
 
I can't tell. The titlebar just says Error and the message says:

The program ["blah\blah.exe "x" "y" 4 "z"] caused a problem and is going to close. Would you like to save a dump file? with Yes and No buttons.

I never get to the vb.net main form.
 
blah.exe is the name of my vs2005 vb.net exe and the parameters to pass to it follow in the error message.
 
Interesting. First, I would stick a message box into the VB6 app to see exactly what command it was feeding into the shell. Then I would look into error logging in the VB.Net app to determine if it makes it into the code.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Unfortunately, I don't get the problem on the development pc, I get other errors further along in the vb.net app like Microsoft exception errors. The vb.net app works great when it is run by itself... Sometimes I can get it to work ok when called from vb6, sometimes not. Very frustrating. I've read about wrapping the call somehow but not sure this applies.
 
If you are launching the VB.Net app from a shell launched by VB6, you should have to worry about wrapping anything.

If you are trying to access VB.Net classes and methods from VB6, you'll need to register the library for COM interop. You'll have to use RegASM (a tool in the framework folder) to create and register a .TLB file on each workstation that will use the COM application that uses the .Net resources.

At this point, I would say you need to define "sometimes". When does it work vs when doesn't it work. There is very little in the PC realm that is truely random.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top