J
jcrouse
I apologize for starting another thread but the old one had a weird subject
line. Anyways...here is the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strInput As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"
If lblMameExePath.Text <> "" Then
Dim sr As StreamWriter = File.CreateText(strInput)
sr.WriteLine(lblMameExePath.Text & " -listinfo >""" &
Application.StartupPath & "\mamegames.cfg""")
sr.Close()
Dim response As String
response = MsgBox("You will be notified when the operation is
complete.", MsgBoxStyle.OKOnly, "CPViewer")
If File.Exists(strInput) Then
Shell(strInput, AppWinStyle.Hide, True)
response = MsgBox("Your file has been created
successfully.", MsgBoxStyle.OKOnly, "CPViewer")
Else
response = MsgBox("Your file has NOT been created.",
MsgBoxStyle.OKOnly, "CPViewer")
End If
Else
Dim response As String
response = MsgBox("You must first specify the path to your mame
executable", MsgBoxStyle.OKOnly, "CPViewer")
End If
End Sub
The variable strInput contains a path and file name. It gets created fine
using the streamwriter. the If File.Exists even evaluates to true and the
code enters the if statement. When it gets to the shell command it errors
out whith the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
microsoft.visualbasic.dll
Additional information: File not found.
How can this possible be. It's almost like its a bug with the Shell command.
It was working for a while. Well, upon further checking here is what I got.
It worked in the GDI. I created an install package. Installed the app and it
worked. I messed around a little (not sure what I did) in the GDI and now it
won't work while in the GDI. I created another install package, installed it
and it works great but still won't work inside the GDI. Any ideas here? I'm
lost.
Thank you,
John
line. Anyways...here is the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strInput As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"
If lblMameExePath.Text <> "" Then
Dim sr As StreamWriter = File.CreateText(strInput)
sr.WriteLine(lblMameExePath.Text & " -listinfo >""" &
Application.StartupPath & "\mamegames.cfg""")
sr.Close()
Dim response As String
response = MsgBox("You will be notified when the operation is
complete.", MsgBoxStyle.OKOnly, "CPViewer")
If File.Exists(strInput) Then
Shell(strInput, AppWinStyle.Hide, True)
response = MsgBox("Your file has been created
successfully.", MsgBoxStyle.OKOnly, "CPViewer")
Else
response = MsgBox("Your file has NOT been created.",
MsgBoxStyle.OKOnly, "CPViewer")
End If
Else
Dim response As String
response = MsgBox("You must first specify the path to your mame
executable", MsgBoxStyle.OKOnly, "CPViewer")
End If
End Sub
The variable strInput contains a path and file name. It gets created fine
using the streamwriter. the If File.Exists even evaluates to true and the
code enters the if statement. When it gets to the shell command it errors
out whith the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
microsoft.visualbasic.dll
Additional information: File not found.
How can this possible be. It's almost like its a bug with the Shell command.
It was working for a while. Well, upon further checking here is what I got.
It worked in the GDI. I created an install package. Installed the app and it
worked. I messed around a little (not sure what I did) in the GDI and now it
won't work while in the GDI. I created another install package, installed it
and it works great but still won't work inside the GDI. Any ideas here? I'm
lost.
Thank you,
John