我试图找出 ListBox 没有填充的简单原因,目的是在目录中查找文件。文件通常看起来像这样FY12 Month02 BMD Mold Line.pdf
,所以我为年、月和类型制作了三个文本框。我还想知道CONTAINS
为一个文件名使用三个搜索字段的最佳方法是什么?
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim year, month, type As String
year = InternalAuditYear.Text
month = InternalAuditMonth.Text
type = InternalAuditType.Text
Dim FileList As String() = Directory.GetFiles("X:\Internal audits\", ".pdf", SearchOption.AllDirectories)
For Each foundFile As String In FileList
Dim GOTCHA As String = Path.GetFileName(foundFile)
ListBox1.Items.Add(GOTCHA)
Next
End Sub