Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • Leaders
Posted

use System.Diagnostics.Process.Start

 

eg:

[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]

Posted
use System.Diagnostics.Process.Start

 

eg:

[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

Posted
Yeah' date=' it seems like a waste..[/quote']

 

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

  • Leaders
Posted

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

Posted
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. ;)
  • 3 weeks later...
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...