|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need Help with ShellIt throws a file not found exception Thanks Dim s As String = sgAppPath + "TCW3Help.pdf" Try If Not File.Exists(s) Then MsgBox("Cannot find " + s, MsgBoxStyle.Exclamation) Else s = """" + s + """" Shell(s) End If Catch ex As FileNotFoundException MsgBox("Unable to open Help file " + s + " check that Acrobat is installed", MsgBoxStyle.Exclamation) Catch ex As Exception ReportBug(ex, "Trying to open help file " + s) End Try Try this:
Dim s As String = Application.StartupPath & "\TCW3Help.pdf" Try If Not IO.File.Exists(s) Then MessageBox.Show(String.Format("Cannot find {0}", s), Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Else Microsoft.VisualBasic.Shell(s, AppWinStyle.NormalFocus) End If Catch ex As IO.FileNotFoundException MessageBox.Show(String.Format("Unable to open Help file {0}. Check that Acrobat is installed", s), Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Catch ex As Exception MessageBox.Show(ex, "Trying to open help file " + s) End Try I hope this helps Crouchie1998 BA (HONS) MCP MCSE Thanks but still get the same thing, exception on the shell command.
Any other ideas? Crouchie1998 wrote: Show quoteHide quote > Try this: > > Dim s As String = Application.StartupPath & "\TCW3Help.pdf" > Try > If Not IO.File.Exists(s) Then > MessageBox.Show(String.Format("Cannot find {0}", s), > Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) > Else > Microsoft.VisualBasic.Shell(s, AppWinStyle.NormalFocus) > End If > Catch ex As IO.FileNotFoundException > MessageBox.Show(String.Format("Unable to open Help file {0}. > Check that Acrobat is installed", s), Me.Text, MessageBoxButtons.OK, > MessageBoxIcon.Exclamation) > Catch ex As Exception > MessageBox.Show(ex, "Trying to open help file " + s) > End Try > > I hope this helps > > Crouchie1998 > BA (HONS) MCP MCSE > > I changed the filename to one on my system & it worked for me. Just play
around with the Try Catch End Try block. Sorry, but I don't have the time to do anything else for the next 3-4 hours, but later if you don't have a solution then I'll re-write it for you. Crouchie1998 BA (HONS) MCP MCSE Thanks, still no joy but took Cors suggestion and used process.start -
no problems. One thing I can say for .net, there seem to a thousand ways of doing anything and one eventually works! Crouchie1998 wrote: Show quoteHide quote > I changed the filename to one on my system & it worked for me. Just play > around with the Try Catch End Try block. > > Sorry, but I don't have the time to do anything else for the next 3-4 hours, > but later if you don't have a solution then I'll re-write it for you. > > Crouchie1998 > BA (HONS) MCP MCSE > > I just recoded your solution because that's the way you wanted to code it.
Process.Start is an easier way, I agree Crouchie1998 BA (HONS) MCP MCSE Jack,
Did you try it already with Process.Start(filenme) (Needs a reference to be set). Pdf, should of couse start when you click in explorer on that, otherwise you have to name the program in this method as well. In addition when you try something, set than first the hardcoded path in it, that makes finding an error much easier. I hope this helps, Cor Cor,
Thanks that worked! Cor Ligthert wrote: Show quoteHide quote > Jack, > > Did you try it already with Process.Start(filenme) > (Needs a reference to be set). > > Pdf, should of couse start when you click in explorer on that, otherwise you > have to name the program in this method as well. > > In addition when you try something, set than first the hardcoded path in it, > that makes finding an error much easier. > > I hope this helps, > > Cor > > "Crouchie1998" <crouchie1998@spamcop.net> schrieb: => 'System.IO.Path.Combine'. Otherwise the path will contain two > Dim s As String = Application.StartupPath & "\TCW3Help.pdf" backslashes if the application is installed to a drive's root directory. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Need to sort ListView columns that contain dates
Accessing dlls at runtime C# to VB crossover questions hide control based on SQLS2K column level permission Update Element in ArrayList Structure Large fonts setting (120DPI) GetType and ApplicationClass About MessageQueue Problem Using JPG stills to make a "Video" file c# to vb.net converter |
|||||||||||||||||||||||