我尝试制作一个可以显示一行中所有项目的arraylist。
Dim listarray As New ArrayList
Dim JARLIB As String = "*.jar"
Dim dir As New IO.DirectoryInfo(GetFolderPath(SpecialFolder.ApplicationData) & "\.minecraft\libraries\")
Dim diarr1() As IO.FileInfo = dir.GetFiles(JARLIB, SearchOption.AllDirectories)
Dim drar As IO.FileInfo
'list the names of all files in the specified directory
For Each drar In diarr1
listarray.Add((drar.DirectoryName) & ";")
Next
elemante = listarray.ToString
RichTextBox1.Text = elemante
这不起作用,我必须在TextBox中找到像
这样的东西C:\User\file.jar;C:\User\file\file2.jar;
你能帮帮我吗?谢谢!
答案 0 :(得分:1)
listarray.ToString
不会返回ArrayList
的所有元素。
看起来你想要这样的东西:
Dim listarray As New ArrayList
Dim JARLIB As String = "*.jar"
Dim dir As New IO.DirectoryInfo(GetFolderPath(SpecialFolder.ApplicationData) & "\.minecraft\libraries\")
Dim diarr1() As IO.FileInfo = dir.GetFiles(JARLIB, SearchOption.AllDirectories)
Dim drar As IO.FileInfo
'list the names of all files in the specified directory
For Each drar In diarr1
listarray.Add((drar.DirectoryName) & ";")
Next
For Each item In listarray
elemante = elemante & item.ToString
Next
RichTextBox1.Text = elemante