Results 1 to 2 of 2

Thread: Backup Funktion

  1. #1

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134

    Backup Funktion

    I’m trying to do a simple backup to a Floppy but I don’t know how to code it to where it loops until it has successfully written my file!
    I would appreciate it very much if someone could show me!
    Thanks!!!
    Here is what I have!
    VB Code:
    1. Dim result As MsgBoxResult
    2.         result = MessageBox.Show("Please Insert a Floppy Disk into Drive A:\", "Insert Floppy", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
    3.  
    4.         If result = MsgBoxResult.OK Then
    5.             Try
    6.                 System.IO.File.Delete("A:\MyFile")
    7.                 System.IO.File.Copy("C:\Program Files\My Program\My File", "A:\My File")
    8.             Catch ex As Exception
    9.                 MessageBox.Show(ex.Message, " An Error has Occurred! ")
    10.             End Try
    11.  
    12.         ElseIf result = MsgBoxResult.Cancel Then
    13.  
    14.             Exit Sub
    15.  
    16.         End If
    Last edited by Rally2000; Jan 7th, 2004 at 02:52 AM.
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    One way of doing it could be to use streams instead of the copy method.

    If you open and read the original file as a stream, you can read the entire file into a byte array.

    Then you can open a new stream on the floppy, where you can write the same byte array, one byte at a time. this way you can even have a progressbar showing you how far you got.
    If you want to speed it up, you should probably write 1024 bytes at a time, but that's up to you, how many you want.

    Hope this is help to you. If not, please ignore..
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width