copy past and delete

bilalzaink

Member
Joined
Dec 21, 2011
Messages
5
Programming Experience
Beginner
my Dos Command ..

"""""

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.Filter = "deb filesFiles|*.deb"
openFileDialog1.Title = "Select a Cursor File"

If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then

System.IO.File.Copy(openFileDialog1.FileName, ("data/tempfile"))

Dim FileToexit As String
Dim FileToDelete As String
FileToexit = "data/tempfile"
FileToDelete = "data/tempfile"
If System.IO.File.Exists(FileToexit) = True Then

Shell("data\iphuc -a com.apple.afc2 -s data/scripttemp")..command for use..tempfile copy to device..

System.IO.File.Delete(FileToDelete)

End If

End If
End Sub
""""""


when my btn click then "tempfile" copy ok but its delete before my shell command execute....
So How I Can Delete "tempfile" After my Shell command ececute...

 
Don't use Shell at all for anything. In VB.NET, use Process.Start. Depending on which overload you use, it is either called on an existing Process object or it returns a new Process object. You can then call WaitForExit on that Process object.

Alternatively, if you don't want to block the thread that you call Process.Start on, you can handle the Exited event of the Process object instead and then delete the file in the event handler.
 
Back
Top