Solved

How to open an executable from a button within a VB Appl

Posted on 2006-06-16
9
232 Views
Last Modified: 2010-04-30
I'm sure this is quite simple, but in my quick searches, I can't find a solution.

I am new to Visual Basic, although I'm proficient with VBA within MS Access.

I am attempting to create a very small VB program that opens a small window with some verbiage and a button.  The button should simply open up an executable application on the user's PC.

I already have the form (project) created and a button, but I can't figure out the VB code to perform this simple action.

The file is: C:\QMIS\QmisUI.exe

Thanks!
0
Comment
Question by:bkapla1
  • 6
  • 3
9 Comments
 
LVL 5

Expert Comment

by:lunchbyte
Comment Utility
Shell

try Shell "C:\QMIS\QmisUI.exe"
0
 
LVL 5

Expert Comment

by:lunchbyte
Comment Utility

' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)   ' Run Calculator.

Here is a better exmaple.
0
 
LVL 5

Expert Comment

by:lunchbyte
Comment Utility
The regular shell will launch your program and continue on with the codes in your VB6. This API will launch your program and wait until that program is close then continue on with the codes in VB6.

http://freevbcode.com/ShowCode.Asp?ID=3441
0
 

Author Comment

by:bkapla1
Comment Utility
Hmmm... still didn't work, I even tried your specific example of the calc.

The error is SecurityException was unhandled.... Request for permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed

I literally just installed VisualStudio express onto my PC this morning, so this is also the first time I've used it.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:lunchbyte
Comment Utility
LOL, you may want to post your question in vb.net. The code I gave you is for VB.

Someone who knows VB.net may come along but you need to post your question there for better help.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/
0
 
LVL 5

Accepted Solution

by:
lunchbyte earned 500 total points
Comment Utility
0
 

Author Comment

by:bkapla1
Comment Utility
Ahh... maybe that's the ticket... too many "types" of VB out there

I actually don't care what type of application it is as my goal is to simply have a quick and easy application on the user's desktop that will perform this function.

If I want to use straight VB vs. VB.net, how to I create a VB application (what development tool do I need to do this)?
0
 
LVL 5

Expert Comment

by:lunchbyte
Comment Utility
You cannot buy VB6 anymore because it’s an old language and VB.Net is the next generation.  You already have Visual Studio express (free right) so you’re best bet is to start from there not the old language because it is different in many ways.
0
 

Author Comment

by:bkapla1
Comment Utility
Ok, I'll keep trying.

Thanks for your help and clarification that Visual Studio uses VB.Net, not just VB... I'll get it straight!!

I'll give you the points for pointing me in the right direction!

Thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now