0

我尝试制作一个可以在一行中显示所有项目的数组列表。

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;

你能帮助我吗 ?谢谢 !

4

1 回答 1

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
于 2013-07-10T08:17:19.910 回答