Problem With OpenFileDialog

W

Wayne Wengert

I am having a problem getting OpenFileDialog to work as expected (see code
below). When I execute the code I do not see the Title I set, nor is the
Filter applied. The "Open" dialog comes up, I select the file I want, and
then the dialog comes up again with my selection in the File Name box. When
I click Open - nothing seems to happen - the variables are not set - it is
as if the dialog never occurred?

===========================================
Dim o1 As New OpenFileDialog

With o1

..Filter = "MS Access Database Files (*.MDB) | *.MDB"

..Title = "Select the existing file to Open"

..InitialDirectory = "c:\Program Files\MyApp"

If .ShowDialog = DialogResult.OK Then

ActiveDBFile = .FileName

Me.lblNameOfDBFile.Text = ActiveDBFile

Me.Refresh()

End If

End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top