Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filecopy when file is in use

Status
Not open for further replies.

KevCon

Programmer
Jul 11, 2001
44
US
i have had the hardest time finding any specific solutions for this...so I guess this is more of a tip but I wonder if anybody has a better way of doing it.......I apologize if this is common knowledge to some but it works great for me and i'm excited...!!!

I have an .ADE file that i want to copy from the network to a user's hard drive and then execute(open)_ every time they want to start the program.

if for some reason the file is open, and say minimized, if they were to try this, since opened files as such are blocked from deleting when opened, here's what i found will trap a System IO Excepetion error:



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
FileCopy("c:\test\net\test.ade", "c:\test\local\test.ade")
System.Diagnostics.Process.Start("c:\test\local\test.ade")
Catch ex As IOException
MsgBox("File is already open.")
Close()
Finally
Close()
End Try
End Sub

End Class




---------I just run this as a small blank form, create the shortcut for the user and they're good to go.

any easier or safer way?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top