Greetings all. I am totally new to vs2008 and programming in general so please bear with me.
I have a menu item called Update that uses this code when clicked:
Private Sub UpdateDatabaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateDatabaseToolStripMenuItem.Click
My.Computer.Network.DownloadFile _
("http://www.mysitecom/downloads/data/test.xls", _
"C:\test\test.xls", False, 500)
End Sub
It works great except for the fact that if the file already exists I get an error. Is there a way to write the code to overwrite the C:\test\test.xls file?
Also clicking the menu item when a file is not located on the web also gives an error and halts the program. From my understand I will need to write an exception handler.
Any quick tips will be greatly appreciated.
I have a menu item called Update that uses this code when clicked:
Private Sub UpdateDatabaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateDatabaseToolStripMenuItem.Click
My.Computer.Network.DownloadFile _
("http://www.mysitecom/downloads/data/test.xls", _
"C:\test\test.xls", False, 500)
End Sub
It works great except for the fact that if the file already exists I get an error. Is there a way to write the code to overwrite the C:\test\test.xls file?
Also clicking the menu item when a file is not located on the web also gives an error and halts the program. From my understand I will need to write an exception handler.
Any quick tips will be greatly appreciated.