Open File Dialog Help

nd54

Newcomer
Joined
May 2, 2003
Messages
8
Location
CA
Hey all trying to get this Open File Dialog to work...
When I hit cancel on the second time it adds the file to the list anyways



Visual Basic:
    Private Sub MenuItem3_Click(ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles MenuItem3.Click
Dim ofd As New OpenFileDialog()
Dim lv As ListViewItem
      ofd.Title = "Select  FILE TO OPEN..."
        ofd.Filter = "All Files(*.*)|*.*"
        ofd.ShowDialog()
        If ofd.FileName = "" Then Exit Sub
lv = ListView1.Items.Add(ofd.filename
lv.subitem.add("test")
lv.subitem.add("testing")
end sub


Thank You
 
Visual Basic:
If ofd.ShowDialog() = DialogResult.Cancel Then Exit Sub

You should be using that instead of checking the length of the filename.
 
Back
Top