Malasuerte94
Malasuerte94

Reputation: 1474

VB.NET arraylist display in a single row

I try to make an arraylist which can display all items in one row.

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

And that is not working, i must recive in TextBox something like

C:\User\file.jar;C:\User\file\file2.jar;

Can you help me ? Thanks !

Upvotes: 0

Views: 1140

Answers (1)

Andrey Gordeev
Andrey Gordeev

Reputation: 32469

listarray.ToString won't return you all the elements of the ArrayList.

It seems you want something like this:

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

Upvotes: 1

Related Questions