I initiate OpenFileDialog from a btn and once the correct file is selected at OpenFileDialog1_FileOK * ,I want to load Form2 to do some file checking routines.
Private Sub OpenFileDialog1_FileOk(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
dbfFileFolder = System.IO.Path.GetDirectoryName(OpenFileDialog1.FileName)
dbfFileName = System.IO.Path.GetFileName(OpenFileDialog1.FileName)
dbfFileNameShort = System.IO.Path.GetFileNameWithoutExtension(OpenFileDialog1.FileName)
If dbfFileName = "GNDITEM.DBF" Then
frmFileCheck.Show() 'this is my Form2
End If
End Sub
The new Form2 shows on top of the OpenFileDialog (which is obviously on top of the Form1) only AFTER completing those events.
If I don't have any events on Form2 all works perfect; the OpenFileDialog closes as I had hoped. What would possibly be keeping OpenFileDialog open?
Appreciate your help