Advertisement
smashapps

Add items to a listbox

Dec 22nd, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Try
  2.                
  3.                 Dim di As New DirectoryInfo(Application.StartupPath & "\Characters\")
  4.                 ' Get a reference to each file in that directory.
  5.                Dim fiArr As FileInfo() = di.GetFiles()
  6.                 ' Display the names of the files.
  7.                Dim fri As FileInfo
  8.                 For Each fri In fiArr
  9.                     If fri.Extension = ".png" Then
  10.                         TotalCharactersFound += 1
  11.                         Dim s As String
  12.                         s = fri.Name
  13.                         ListBox1.Items.Add(s.Substring(0, s.Length - 4))
  14.                     End If
  15.                 Next fri
  16.                 Label1.Text = "Total Characters Found: " & TotalCharactersFound
  17.             Catch ex As Exception
  18.                 MsgBox(ex.Message)
  19.             End Try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement