0
我想根據組合框中選擇的內容將文件添加到列表框中。正在根據文件名中的特定字符串從目錄中提取文件。但是,當我從組合框中選擇一個選項時,沒有任何反應,並且沒有任何內容顯示在列表框中。在VB.Net中使用組合框將文件添加到列表框
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles combobox_COFR.SelectedIndexChanged
Dim folderInfo As New IO.DirectoryInfo("\\networkname\subdirectory")
Dim arrFilesInFolder() As IO.FileInfo
Dim fileInFolder As IO.FileInfo
If combobox_COFR.Text = "Agendas" Then
arrFilesInFolder = folderInfo.GetFiles("*Agenda*")
For Each fileInFolder In arrFilesInFolder
ListBox1.Items.Add(fileInFolder.Name)
Next
End If
If combobox_COFR.Text = "Minutes" Then
'Do same thing with different filename
End If
If combobox_COFR.Text = "Secretary" Then
'Do same thing with different file name
End If
End Sub