We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,304 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Vb.NET Shell command

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

2
Contributors
3
Replies
19 Hours
Discussion Span
1 Year Ago
Last Updated
4
Views
Question
Answered
MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11

o yeah thanks man

MarkGia
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by adam_k

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1120 seconds using 2.64MB