473,407 Members | 2,359 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,407 software developers and data experts.

Disable opening of certain files in OpenFileDialog

Hello,

I was hoping someone could help me with my recent problem i have 1 OpenFileDialog and i want the user to only open 1 sort of file so this is what i have

If ReadCon.GetName(OFD.FileName) = "CON " Then
GameSaveLoc = OFD.FileName
LoadCon()
Else
MessageBox.Show("You cannot use this kind of file!")
Save.Enabled = True
End If

its using CON files if you dont understand because of it, it says If the extension is not CON then show MessageBox error although this works fine on most files it isnt on some for example all microsoft office files and some image files god knows how many others =] so if anyone could help me i would be very greatfull
Nov 7 '08 #1
2 1578
jg007
283 100+
can you not just amend the file filter from '*.*' to '*.con' for the open file dialog?
Nov 8 '08 #2
debasisdas
8,127 Expert 4TB
you can filter the files by the file extension.
Nov 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stephen LeBlanc | last post by:
I'm having an issue coding in VB.NET. I'm trying to create a program that let's a user choose 2 files, using the OpenFileDialog control:1 file exists and contains data for extraction, the other...
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...
16
by: iwdu15 | last post by:
how can i open a file i saved and place the info into different text boxes?
5
by: Scott M. Lyon | last post by:
My application (a VB.NET 2003 WinApp) currently has first an OpenFileDialog (asking for an input file to the process I'm working on), and then once the user selects that, it brings up a...
8
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the dialog first opens, the filter works correctly, and...
2
by: AMP | last post by:
Hello, I'm not sure this is the best way but, I have a txt file I want to put into a TextBox: OpenFileDialog opnFile = new OpenFileDialog(); opnFile.Filter = "txt files (*.txt)|*.txt|All files...
8
by: gazza67 | last post by:
Hi, I want to do something that I thought would be simple but i cant seem to work it out, perhaps someone out there could help me. I want to browse for a file (it will be a word document),...
6
by: johnlarson | last post by:
I am using an openfiledialoge to open a dbf file in a windows app. the error I get is c:\myfile.dbf not an valid filename. here is my code private void button1_Click ( object sender , EventArgs e...
2
by: awasm | last post by:
I have written the following code in VB6 and I want to open multiple files in a single go through the openfiledialog. Please help me as I'm a beginner in VB6. Application.ScreenUpdating = False ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.