Code:Imports System.IO Public Class frmCopyFile Dim FromFile As String = "" Dim ToFile As String = "" Private Sub frmCopyFile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load txtFile.Text = "Data.txt" txtFromMachine.Text = "D:\Test\" FromFile = Trim(txtFromMachine.Text) + Trim(txtFile.Text) txtToMachine.Text = "\\isoftnode\test\" ToFile = Trim(txtToMachine.Text) + Trim(txtFile.Text) txtUserName.Text = "Rajat" txtPassword.Text = "abc123" End Sub Private Sub cmdCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopy.Click Try My.Computer.FileSystem.CopyFile(FromFile, ToFile, True) Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try MsgBox("File Copy Successfully") End Sub End Class




Reply With Quote