Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Generate Backup Folder Which Monitor a Folder and create its Backup C#.net application in .NET 2.0.

Author: Zunnair
Download Source Code : 610_Folder Backup.zip

In this simple article you will learn that how you can Generate Backup Folder Which Monitor a Folder and Create its Backup.

Simply just create New Project of console application in C#.

 

Drag two text box and four buttons on form.

 

This Application Copy And Delete Specific file using .net interface. This is very use full Application for Beginners.  

 

Insert FolderBrowserDialog and openFileDialog in your application.

 

 

Now create Global Variables

 

Dim destination As String

Dim start As Integer = 0

 

 

Now just write code against these events

 

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Me.Text = "DevAsp"

        Me.BackColor = Color.LightSeaGreen

        FileSystemWatcher1.Path = "c:\"

 

    End Sub

 

 

 

    Private Sub FileSystemWatcher1_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created

        If start = 1 Then

 

            Dim f As New FileInfo(inp.Text + "\" + e.Name)

 

            Try

                f.CopyTo(destination + "\" + e.Name)

            Catch ex As Exception

                MessageBox.Show(ex.Message)

            End Try

 

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 

        FolderBrowserDialog1.ShowDialog()

        inp.Text = FolderBrowserDialog1.SelectedPath

        FileSystemWatcher1.Path = inp.Text

 

    End Sub

 

  

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        FolderBrowserDialog1.ShowDialog()

        out.Text = FolderBrowserDialog1.SelectedPath

        destination = out.Text

 

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        start = 1

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        start = 0

    End Sub

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Folder Monitoring Application Using File System Watcher in .NET 2.0.

Disclaimer - Privacy
© 2002-2017 DevASP.net