Hey
I am searching a dir for keywords and when it finds a file it adds it to a list box. here is the code
VB Code:
  1. Dim TheDir As String = txtDir.Text
  2.         Dim di As New IO.DirectoryInfo(TheDir)
  3.         Dim diar1 As IO.FileInfo() = di.GetFiles()
  4.         Dim dra As IO.FileInfo
  5.    
  6.         For Each dra In diar1
  7.             Dim Filename As String = IO.Path.GetFileNameWithoutExtension(dra.FullName)
  8.             If dra.Extension = ".rtf" Or dra.Name.ToLower.IndexOf(txtSong.Text.ToLower) > -1 Then
  9.          
  10.                 results.Items.Add(dra)
  11.  
  12.             End If
  13.         Next


that works and it adds them to a list box my problem it that i want to use the data in the listbox as a string and don't know how to convert it.

if i try to go messagebox.show (results.SelectedItem) i get the error : Cast from type 'FileInfo' to type 'String' is not valid.

If anyone knows how to conver the listbox to a sting that would be great thanks alot