473,785 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDatabase.Cli ck
Dim objOpenFileDial og As New OpenFileDialog

With objOpenFileDial og
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirecto ry = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDial og.ShowDialog = DialogResult.OK Then
txtDatabase.Tex t = objOpenFileDial og.FileName
End If
End Sub
-----------------------------
Thanks,
Mike
Nov 21 '05 #1
4 3620
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********@yah oo.com> escribió en el mensaje
news:iw******** ***********@tor nado.texas.rr.c om...
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_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDatabase.Cli ck
Dim objOpenFileDial og As New OpenFileDialog

With objOpenFileDial og
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirecto ry = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDial og.ShowDialog = DialogResult.OK Then
txtDatabase.Tex t = objOpenFileDial og.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_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDatabase.Cli ck
Dim objOpenFileDial og As New OpenFileDialog

With objOpenFileDial og
.Filter = "Access Database (*.mdb)|*.mdb | All files (*.*)|*.*"
.FilterIndex = 1
.InitialDirecto ry = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDial og.ShowDialog = DialogResult.OK Then
txtDatabase.Tex t = objOpenFileDial og.FileName
End If
End Sub


Not tried, but remove the spaces between the filter entries:
..Filter = "Access Database (*.mdb)|*.mdb|A ll 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_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDatabase.Cli ck
Dim objOpenFileDial og As New OpenFileDialog

With objOpenFileDial og
.Filter = "Access Database (*.mdb)|*.mdb | All files
(*.*)|*.*"
.FilterIndex = 1
.InitialDirecto ry = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDial og.ShowDialog = DialogResult.OK Then
txtDatabase.Tex t = objOpenFileDial og.FileName
End If
End Sub


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

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

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

-m

"Angel J. Hernández M." <an**********@h otmail.com> wrote in message
news:Of******** ******@TK2MSFTN GP09.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********@yah oo.com> escribió en el mensaje
news:iw******** ***********@tor nado.texas.rr.c om...
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_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDatabase.Cli ck
Dim objOpenFileDial og As New OpenFileDialog

With objOpenFileDial og
.Filter = "Access Database (*.mdb)|*.mdb | All files
(*.*)|*.*"
.FilterIndex = 1
.InitialDirecto ry = "C:\"
.Title = "Open Access Database"
End With

If objOpenFileDial og.ShowDialog = DialogResult.OK Then
txtDatabase.Tex t = objOpenFileDial og.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
5736
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 in vsnet c#? THX
6
1806
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 from "OpenFileDialog" and then display it in a picturebox. This actually works properly before the button1 is clicked. Button1 is a button to open a new form and again it gets a panel returned from the static method inside "Coord" and perform the...
3
360
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 (*.mdb)|*.mdb|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == DialogResult.OK) DataBaseLocation.Text = openFileDialog.FileName;
4
8009
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 Explorer i am getting error saying that cannot delete that folder as some process is using it. After that i selected a file from the same folder in OpenFileDialog. When i tried to delete the folder after selecting the file also it is giving the...
1
4436
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 f(openFileDialog.ShowDialog() == DialogResult.OK) { ... } Now I discover that there is a hardcoded limit of 200 files.
2
2364
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 OpenFileDialog; openFileDialog1->InitialDirectory = "c:\\"; openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFileDialog1->FilterIndex = 2;
0
1073
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 problem. Invalidate() and Refresh() did not help. I tried to fill paths to TextBox, just for test only. Everything work fine, but I have to use ListView or ListBox.
11
14274
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 the result of openfiledialog box, for example my filename's are added into listbox or my audio file is being played from the beginning. To explain better: openfileplaylist.ShowDialog()
4
4241
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 drive "e:\", people can still browse other drives(drive c, d, etc. ) so for example, when they insert their flash drives, then they open the openfiledialog, how can i make an error trap on how to let them open files only in their flash drives...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.