This is how I generate the text files
Private Sub GenerateTxtFiles()
System.IO.Directory.CreateDirectory("c:\test")
For i As Integer = 0 To 99
Console.WriteLine("Creating: " & "c:\test\filetest" & i & ".txt")
Dim fs As System.IO.FileStream = System.IO.File.Create("c:\test\filetest" & i & ".txt")
fs.Close()
Next
End Sub
This is how I populate the CheckedBoxList
Private Sub populateList()
Dim tempDirectory As String = "c:\test"
If (Directory.Exists(tempDirectory)) Then
Try
Dim Files() As String = Directory.GetFiles(tempDirectory)
For Each Filename As String In Files
CheckedListBox1.Items.Add(String.Format("Threat Found:{0}", Filename), True)
Next
Catch ex As Exception
End Try
End If
End Sub