473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem vieing .mdb files with openfiledialog

I need help understanding why the following code is not working correctly.
When run, I can open .mdb files by changing the filter option to "All Files
(*.*)" but while "Access Database (mdb.*)" is selected no db files are
listed in the OpenFileDialog box....
-------------------------------------
Private Sub btnDatabase_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDatabase.Click
Dim objOpenFileDialog As New OpenFileDialog

With objOpenFileDialog
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDialog.ShowDialog = DialogResult.OK Then
txtDatabase.Text = objOpenFileDialog.FileName
End If
End Sub
-----------------------------
Thanks,
Mike
Nov 21 '05 #1
4 3599
Hi there... You shouldn't leave spaces between pipe or separator (Chr 124)
and pipe (Check the second separator). You wrote something like
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"

instead of

.Filter = "Access Database (*.mdb)|*.mdb| All files (*.*)|*.*"

Regards,
--
Angel J. Hernández M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda
http://www.consein.com
"Mike" <th********@yahoo.com> escribió en el mensaje
news:iw*******************@tornado.texas.rr.com...
I need help understanding why the following code is not working correctly.
When run, I can open .mdb files by changing the filter option to "All Files
(*.*)" but while "Access Database (mdb.*)" is selected no db files are
listed in the OpenFileDialog box....
-------------------------------------
Private Sub btnDatabase_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDatabase.Click
Dim objOpenFileDialog As New OpenFileDialog

With objOpenFileDialog
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDialog.ShowDialog = DialogResult.OK Then
txtDatabase.Text = objOpenFileDialog.FileName
End If
End Sub
-----------------------------
Thanks,
Mike

Nov 21 '05 #2
Mike schrieb:
I need help understanding why the following code is not working correctly.
When run, I can open .mdb files by changing the filter option to "All Files
(*.*)" but while "Access Database (mdb.*)" is selected no db files are
listed in the OpenFileDialog box....
-------------------------------------
Private Sub btnDatabase_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDatabase.Click
Dim objOpenFileDialog As New OpenFileDialog

With objOpenFileDialog
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDialog.ShowDialog = DialogResult.OK Then
txtDatabase.Text = objOpenFileDialog.FileName
End If
End Sub


Not tried, but remove the spaces between the filter entries:
..Filter = "Access Database (*.mdb)|*.mdb|All files (*.*)|*.*"

Thorsten Doerfler
--
http://www.vb-hellfire.de/
Nov 21 '05 #3
Thanks. that was it.
-m
"Thorsten Doerfler" <t.***************@bdsw.de> wrote in message
news:d7**********@news.bdsw.de...
Mike schrieb:
I need help understanding why the following code is not working
correctly.
When run, I can open .mdb files by changing the filter option to "All
Files
(*.*)" but while "Access Database (mdb.*)" is selected no db files are
listed in the OpenFileDialog box....
-------------------------------------
Private Sub btnDatabase_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDatabase.Click
Dim objOpenFileDialog As New OpenFileDialog

With objOpenFileDialog
.Filter = "Access Database (*.mdb)|*.mdb | All files
(*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDialog.ShowDialog = DialogResult.OK Then
txtDatabase.Text = objOpenFileDialog.FileName
End If
End Sub


Not tried, but remove the spaces between the filter entries:
.Filter = "Access Database (*.mdb)|*.mdb|All files (*.*)|*.*"

Thorsten Doerfler
--
http://www.vb-hellfire.de/

Nov 21 '05 #4
Thanks,
that was it.

-m

"Angel J. Hernández M." <an**********@hotmail.com> wrote in message
news:Of**************@TK2MSFTNGP09.phx.gbl...
Hi there... You shouldn't leave spaces between pipe or separator (Chr 124)
and pipe (Check the second separator). You wrote something like
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"

instead of

.Filter = "Access Database (*.mdb)|*.mdb| All files (*.*)|*.*"

Regards,
--
Angel J. Hernández M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda
http://www.consein.com
"Mike" <th********@yahoo.com> escribió en el mensaje
news:iw*******************@tornado.texas.rr.com...
I need help understanding why the following code is not working correctly.
When run, I can open .mdb files by changing the filter option to "All
Files (*.*)" but while "Access Database (mdb.*)" is selected no db files
are listed in the OpenFileDialog box....
-------------------------------------
Private Sub btnDatabase_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDatabase.Click
Dim objOpenFileDialog As New OpenFileDialog

With objOpenFileDialog
.Filter = "Access Database (*.mdb)|*.mdb | All files
(*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDialog.ShowDialog = DialogResult.OK Then
txtDatabase.Text = objOpenFileDialog.FileName
End If
End Sub
-----------------------------
Thanks,
Mike


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bonzo | last post by:
Hi, How do I simply open a text file into a textbox? I know that in C++ I'd use something like: if(OpenDialog1->Execute()) Memo1->Lines->LoadFromFile(OpenDialog1->FileName); How can I do it...
6
by: chau_fai | last post by:
I have a window Form called "Form2". There is only one button and a panel returned from a static method of the "Coord" in this form. In the panel returned, there is a button that can choose image...
3
by: bobrad | last post by:
MAYBE SOMEBODY CAM HELP I AM USING THE FOLLOWING CODE TO GET A LOCATION OF A FILE IN A WINFORM DIALOG OpenFileDialog openFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = " Access...
4
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the folder when i tried to delete the same folder in...
1
by: Olaf Baeyens | last post by:
In .NET v1.1 I am trying to select multiple files using OpenFileDialog like this OpenFileDialog openFileDialog=new OpenFileDialog(); openFileDialog.Multiselect=true; i...
2
by: tlemcenvisit | last post by:
Hello I am trying to open a text file, I use this code : private: void button1_Click(System::Object^ sender, System::EventArgs^ e) { Stream^ myStream; OpenFileDialog^ openFileDialog1 = gcnew...
0
by: Ion | last post by:
Hi, I have a ListView that is filled with selected paths from OpenFileDialog. Some times ListView is not redraw after OpenFileDialog close. I tried to fill paths to ListBox. I got the same...
11
by: kimiraikkonen | last post by:
Hi, Vb.net 2005 express i've been working, the problem is: I use openfiledialog to browse files, i created some code to execute file with OK button, no problem. But if i press "cancel" button as...
4
by: jabslim via DotNetMonster.com | last post by:
excuse me, may i ask on how to open files only in drive "e:\" (which is my usb port for flash drives) using openfiledialog? because in the openfiledialog, even when i set my initialdirectory to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.