Need help checking if file is already saved VB.Net 03


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Need help checking if file is already saved VB.Net 03

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    19

    Need help checking if file is already saved VB.Net 03

    Hello,

    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
    SavePage(eBSS1.ActiveCell.Text, storage)

    End Sub

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    System.IO.File.Exists
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 07:48 PM
  2. Replies: 0
    Last Post: 12-04-2001, 08:40 PM
  3. Checking file access..
    By Siri Mette Haugerud in forum VB Classic
    Replies: 0
    Last Post: 06-26-2001, 11:44 AM
  4. Checking for File Sharing?
    By James Abbott in forum VB Classic
    Replies: 0
    Last Post: 05-29-2001, 04:52 AM
  5. Replies: 2
    Last Post: 12-27-2000, 04:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center