1,105,312 Community Members

Vb.NET Shell command

Member Avatar
MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I have question about shell command

well lets say i have this

Shell("\bin\game.exe", AppWinStyle.NormalNoFocus)

Well as you know the command will come up an say File Not Found

FileNotFoundException

So how can i put this command and when the file is not found turn up with this method

MessageBox.Show("File not found.Please place the program into the program folder")'

Without showing the filenotfound exception

Hope you understand

MarkGia

Member Avatar
MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Well masters i dont think it is difficult to tell me that it is a two minutes answer

Member Avatar
adam_k
Veteran Poster
1,056 posts since Jun 2011
Reputation Points: 239 [?]
Q&As Helped to Solve: 212 [?]
Skill Endorsements: 17 [?]
 
0
 

Using the Try - Catch method.

Try 
Shell("\bin\game.exe", AppWinStyle.NormalNoFocus) 
catch ex as Exception 
if ex.message = "" 'Can't remember the exact text, type in the exact exception message
then MessageBox.Show("File not found.Please place the program into the program folder")
else 
msgbox (ex.message) 
end if
end try
Member Avatar
MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

o yeah thanks man

Question Answered as of 2 Years Ago by adam_k
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: