Hello Stack溢出社区,我在这里为我在VB.net中编程的工具获得一些帮助,我正在使用Visual Studio 2015,我现在正在使用的是一个基本上创建备份的工具一个文件夹,它基本上将所有文件从TextBox1中给出的路径复制到TextBox2中给出的路径,当用户按下“Create”按钮时,它将执行以下代码:
My.Computer.FileSystem.CopyDirectory(TextBox1.Text, TextBox2.Text, True)
它完美无缺,但我想要做的是,我添加的进度条在复制粘贴过程中进行更新,以便用户知道它实际上正在工作。
整个代码在这里:
Public Class Form4
Private Sub FolderBrowserDialog1_HelpRequest(sender As Object, e As EventArgs)
End Sub
Private Sub FolderBrowserDialog2_HelpRequest(sender As Object, e As EventArgs)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
FolderBrowserDialog1.ShowDialog()
End Sub
Private Sub FolderBrowserDialog1_Disposed(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = FolderBrowserDialog1.SelectedPath.ToArray
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
FolderBrowserDialog2.ShowDialog()
End Sub
Private Sub FolderBrowserDialog2_Disposed(sender As Object, e As EventArgs) Handles Button2.Click
TextBox2.Text = FolderBrowserDialog2.SelectedPath.ToArray
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
My.Computer.FileSystem.CopyDirectory(TextBox1.Text, TextBox2.Text, True)
TextBox1.Clear()
TextBox2.Clear()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Me.Hide()
Form3.Show()
End Sub
End Class
如果还有其他我没有解释的内容,请告诉我,谢谢。