Import midi file

I’m writing a program where images of a trombone player can “play along” with a midi file. I have it working just fine if I open a specific file, but when I try use an open file dialogue all my midi files are grayed out. I don’t know much about file types, or how to designate them. What is the correct way to open a midi file?

Here’s what works:

[code] Dim bs As BinaryStream
dim t as string
dim n As Integer
dim mb as MemoryBlock

f = GetFolderItem(“Grieg Trombone new.mid”)
If f.Exists Then
bs = BinaryStream.Open(f, False)
If bs <> Nil Then
t = bs.Read(bs.Length)
mb=t
n=len(mb)
bs.Close
end
end[/code]

Here’s where I am stuck:

Dim dlg as OpenDialog Dim f as FolderItem dlg=New OpenDialog dlg.Title="Select a midi file" f=dlg.ShowModal() If f <> Nil then Dim bs As BinaryStream dim t as string dim n As Integer dim mb as MemoryBlock bs = BinaryStream.Open(f, False) If bs <> Nil Then t = bs.Read(bs.Length) mb=t n=len(mb) bs.Close end end

  //////// Open Dialog ////////
  Dim extension as String = "mid"
  
  Dim myType As New FileType
  myType.Name = Titlecase(extension) + " File (*." + extension + ")"
  myType.MacType = Uppercase(extension) + " "
  myType.Extensions = extension
  
  dim f as FolderItem
  dim dlg as new OpenDialog
  dlg.Filter = myType
  dlg.SuggestedFileName = ""
  f = dlg.ShowModalWithin(main)
  if f <> nil and f.Exists Then
    Dim bs As BinaryStream
    dim t as string
    dim n As Integer
    dim mb as MemoryBlock
    bs = BinaryStream.Open(f, False)
    If bs <> Nil Then
      t = bs.Read(bs.Length)
      mb=t
      n=len(mb)
      bs.Close
    end
  end if
  //////// end Open Dialog ////////

Thank you. Works perfectly.