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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return a value from a VB program

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
How can you return a value (an integer) from a normal VB exe? The program has a 'sub main()' but sub's cannot return values and you can't make the main() sub a function. Any thoughts?

-bitwise
 
Hmm, that doesn't seem to work. I made an ActiveX EXE and then added the following code:

function main()
main = 1
end function

I then ran the program on the command line and checked the return value but it didn't return anything. Is there something that I'm missing or not doing right?

Thanks,
-bitwise
 
I'm confused here. Are u just making a dos program or do you have one program calling another one and wait for a return value from it?

I assumed you needed a way to call a different program from your program and have it return something. If this was the case, then an ActiveX EXE is just another class you can declare inside your VB program. You will need to reference it in project->reference.

If you're writing a DOS program and wants something printed out; that's a different story.
 
There is a MFC C++ application. That application needs to call a VB.exe and know if it succeeded in its execution. So basically from some kind of VB sub main() function I need to return a value to the calling program.

bitwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top