Need help checking if file is already saved VB.Net 03
I am trying to write the code in VB.Net 03 to save a file to a location (C:\) and I would like for when I attempt to save a document to that location to make sure a document with the same name is not already saved and return a message that says file already exists would you like to replace. For example I would like for when I click the button to attempt to save the file to the location and if that file already exists give a message in a text box. I know how to save the file the problem is checking for the file (i.e. maybe an if statement). I'm not sure what code to write to check for the file in that location. Any suggestions would be greatly appreciated. Thank you for your help.
Here's the first part of the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AutoSave.Click
Dim b As Integer
Dim itemID As String
Dim location As String
Dim type As String
Dim storage As String
itemID = eBSS1.ActiveCell.Previous.Value.ToString
location = "C:\"
type = ".mht"
storage = (location & itemID & type)
'Im assuming an if statement can be inserted here but I'm not sure how to write the code to check
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
By jase_dukerider in forum C++
Last Post: 04-14-2005, 07:48 PM
By Phil Weber in forum .NET
Last Post: 12-04-2001, 08:40 PM
By Siri Mette Haugerud in forum VB Classic
Last Post: 06-26-2001, 11:44 AM
By James Abbott in forum VB Classic
Last Post: 05-29-2001, 04:52 AM
By Lim Wing Hoe in forum Java
Last Post: 12-27-2000, 04:22 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center