Launch a program from VB

Level:
Level1

An often requested task that new developers to VB ask is how can I write a program that will launch other programs. Its fun to create your own little launcher program that does things like allows you to quickly launch just the programs you want. Obviously program launchers already exist out on the market that you could simply use. But one of the great things about learning a programming language like Visual Basic is that you can create your own programs that behave exactly how you want them to.

To try out the this sample source code snippet simply create a VB project, add a command button to the main form, double click this button to get into the click event handler for it and add the following code.

  1. Dim Res
  2. Dim Filename
  3.     Filename = "C:\windows\notepad.exe" 'Check file is here first
  4. If Dir(Filename) = "" Then
  5.     MsgBox Filename & " not found", vbInformation
  6. Else
  7.     Res = Shell("Start.exe " & Filename, vbHide)
  8. End If

This source code uses the VB6 Shell command to launch a new program. We specifically call the Start.exe program as it can be used to launch other programs easily.

Note: The source for this was found at DreamVB which is no longer online.

Softside Waterbed According

Softside Waterbed
According to Wiki, the cars acclimatized a Vagrant machine in 4 or 6 cylinder forms which came from the 1948 P3 and had transparency valves for cove and side valves for exhaust. A four-speed guide dissemination was occupied with a column-mounted shifter at first and floor-mounted unit from 1954. At cardinal the gearbox exclusive had synchromesh on third and supreme but it was added to second gear as obviously in 1953. A liberated veer dominance, a standard Tourist memorable part, was fitted to cars without overdrive until more 1959.

Command Line Arguments

How can i start a program with command line arguments?

Nice

nice.but can you give me simple database for attendance for example.....

Listbox Item Adding In MS Access Database

I m creating a small application which have a combobox & listbox & two button add & remove with ms access database.
Add button simply add item of combobox in to listbox
& remove button simply remove the item from listbox.
Now i wnat to insert items of listbox in database.
Single item is inserted but multiple is not inserted.
any one can have any idea...........

how can i lunch programs

how can i lunch programs without given the address? i mean can i lunch them from my program folder so and no need to know the proper address,

vb6

can u give me a sample prog like a
1. count down log-in?
2. grading sheet
3. lucky 7
ty

this wil work

change :
Res = Shell("Start.exe " & Filename, vbHide) Change Start.exe into Explorer.exe BV, then the program wil open notepad.

in Res = Shell("program that

in Res = Shell("program that u wanna open/link " & Filename, vbHide), try to remove "& filename"... it'll work ^^

Video Rental

Sir/Ma'am

Please help me on how to make a video rental in my activity in our school...
because i don't know how to make it...
please....please....help me......:)

Please tell me how to put

Please tell me how to put install option in a program made by me in VB6, as it happens in real life programs.

maybe it can help u!!

change :
Res = Shell("Start.exe " & Filename, vbHide) become Res = Shell("program that u wanna open/link " & Filename, vbHide)

query

it doesnt work on my pc, can you help me?... when i run the program and click the command button it says that file is not found. runtime error 53.

reply

Check to make sure the path

Check to make sure the path name you have chosen for the project to run is the actual path name the program is located in. You can add an I/O exception that checks for potential path validation issues by creating a "try" clause that procedes the file execution code.

it doesnt work

it doesnt work on my pc, can you help me?... when i run the program and click the command button it says that file is not found. runtime error 53.

would it kill people to

would it kill people to break down the code for once its no good just having little snippits here and there

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options