and use code in button.
- Dim FileToCopy As String
- Dim NewCopy As String
- FileToCopy = "C:\Users\Owner\Documents\test.txt" 'Old path
- NewCopy = "C:\Users\Owner\Documents\NewTest.txt" 'New path
- If System.IO.File.Exists(FileToCopy) = True Then
- System.IO.File.Copy(FileToCopy, NewCopy) ' copy วางทับชื่อซ้ำไม่ได้
- 'System.IO.File.Copy(FileToCopy, NewCopy, True) 'copy วางและแทนที่
- MsgBox("File Copied")
- End If
example :
- Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim FileToCopy As String
- Dim NewCopy As String
- Dim NameImage As String
- FileToCopy = TextBox_URL.Text 'name of text save url.
- NewCopy = "\\server3\7C งทส\00-อื่น ๆ\Personal Data\สุวิทย์ จำปาหอม\ImageAMS\1.jpg"
- If System.IO.File.Exists(FileToCopy) = True Then
- System.IO.File.Copy(FileToCopy, NewCopy)
- MsgBox("File Copied")
- End If
- End Sub
No comments:
Post a Comment