Open .exe through OpenFileDialog

Gooley

Newcomer
Joined
Sep 3, 2005
Messages
5
Is there a way for an application to open other .exe files using an open file dialog? Say, to let the user browse for a .exe file, for example "aim.exe" and execute it?

Much Appreciated.
 
use System.Diagnostics.Process.Start

eg:
Code:
[color=blue]Private Sub[/color] SomeSub()
   [color=blue] Dim[/color] od [color=blue]As New[/color] OpenFileDialog
	[color=blue]With[/color] od
		.Filter = "Applications (*.exe)|*.exe"
	[color=blue]End With[/color]
 
	[color=blue]If[/color] od.ShowDialog = DialogResult.OK [color=blue]Then[/color]
		System.Diagnostics.Process.Start(od.FileName) [color=green]'/// od.FileName being the path of the .exe[/color]
	[color=blue]End If[/color]
[color=blue]End Sub[/color]
 
dynamic_sysop said:
use System.Diagnostics.Process.Start

eg:
Code:
[color=blue]Private Sub[/color] SomeSub()
   [color=blue] Dim[/color] od [color=blue]As New[/color] OpenFileDialog
	[color=blue]With[/color] od
		.Filter = "Applications (*.exe)|*.exe"
	[color=blue]End With[/color]
 
	[color=blue]If[/color] od.ShowDialog = DialogResult.OK [color=blue]Then[/color]
		System.Diagnostics.Process.Start(od.FileName) [color=green]'/// od.FileName being the path of the .exe[/color]
	[color=blue]End If[/color]
[color=blue]End Sub[/color]

Why do you use With/End With for .Filter? :confused:

thanks
 
Gooley said:
Yeah, it seems like a waste..

I'm just curious if there is something that With/End With does that I'm not thinking about... :confused: I just don't see why it would be put in for 1 property... so if it doesn't do anything special... yeah, its a waste.... lol
 
probably because the code in my form originally had more than 1 line inside the With / End With statement :rolleyes:
i did have various other options set like MultiSelect etc... but thought it easier to remove them and just leave the Filter ( incase you didn't understand the Filter property )

however , a point i'd love to state back.
you are quick enough at asking for help, but the appreciation for help seems to have vanished :confused:
maybe some of us are bought up to say thanks when helped by someone else & others are very quick at asking but never can be bothered to actually appreciate it :)

before trying to slate someone else ( who was only trying to help you in his own free time / time he could have spent helping someone who actually respected the help ) try thinking about your own little un polite ways :D
 
I think dynamic_sysop has a very valid point. Obviously given his forum status he understands what a With statement is all about. And obviously you know how to remove it, so why not just thank him/her and be happy that someone has, in their own spare time, had the patience to help you. ;)
 
I'm sorry, I wasn't going off on your coding techniques or anything. I included the word "Seems" in my reply, because I didn't know if you took it from something else or just what.
 
Back
Top