我是VB.net的新手,想要编写一个应用程序来读取带有路径列表的文本文件,计算所有路径中的文件数量,复制路径中的所有内容并通过进度显示进度完成eta的酒吧。
到目前为止,我只读取了文本文件并且计数器正常工作,但无法解决如何使用已存储在pathlist
列表中的路径作为副本中的源。这就是我所拥有的;
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If System.IO.File.Exists(Application.StartupPath + "\CONFIG.txt") = True Then
Dim pathlist As New List(Of String)
' Open config.txt with the Using statement.
Using r As StreamReader = New StreamReader(Application.StartupPath + "\CONFIG.txt")
' Store contents in this String.
Dim line As String
' Read first line.
line = r.ReadLine
' Loop over each line in file, While list is Not Nothing.
Do While (Not line Is Nothing)
' Add this line to list.
pathlist.Add(line)
'count the files in the directories as we go through the loop
counter = System.IO.Directory.GetFiles(line, "*.*", SearchOption.AllDirectories).Count()
'add # of files to overall count
filecount += counter
' Read the next line.
line = r.ReadLine
Loop
End Using
Else
MessageBox.Show("Config.txt does not exist")
End If
'Label Showing total files
Label1.Text = filecount
End Sub
如何使用pathlist中的行字符串执行以下操作:
如果有人可以帮助或链接我一个我可以使用的例子,那就太好了!