473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OpenFileDialog Event Handling

I need to use the OpenFileDialog class to get the name of a file, but I don't
want it to check to see if the file is really there since I may just want to
type an arbitrary name in and create it later. I assume the correct way to
do this is to handle the OK button click event. I found the following
example code but the OK button still doesn't seem to go to my event handler.
Any ideas? Thanks, Ray.
OpenFileDialog openLogFileDialog;
private void GetLogFileName()
{
openLogFileDialog = new OpenFileDialog();
openLogFileDialog.ShowDialog();
}
private void openLogFileDialog_FileOk(object sender,
System.ComponentModel.CancelEventArgs e)
{
// handle the file name in openLogFileDialog.FileName
}
May 30 '07 #1
2 2646
On Wed, 30 May 2007 13:19:01 -0700, Ray Mitchell
<Ra*****************@MeanOldTeacher.comwrote:
I need to use the OpenFileDialog class to get the name of a file, but I
don't
want it to check to see if the file is really there since I may just
want to
type an arbitrary name in and create it later.
I don't know why your FileOk handler isn't executing when the user clicks
the Ok button. However, it seems to me that you would be better off just
setting the CheckFileExists property of the dialog to "false".

Pete
May 30 '07 #2


"Peter Duniho" wrote:
On Wed, 30 May 2007 13:19:01 -0700, Ray Mitchell
<Ra*****************@MeanOldTeacher.comwrote:
I need to use the OpenFileDialog class to get the name of a file, but I
don't
want it to check to see if the file is really there since I may just
want to
type an arbitrary name in and create it later.

I don't know why your FileOk handler isn't executing when the user clicks
the Ok button. However, it seems to me that you would be better off just
setting the CheckFileExists property of the dialog to "false".

Pete
I didn't realize this property existed. It's just what I need. Thanks!
May 30 '07 #3

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

Similar topics

4
by: hillcountry74 | last post by:
Hi, I'm a newbie and trying to understand event handling in c#. I have understood handling events using delelgate objects. But not this method- "Event handling by overriding the virtual...
3
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the...
9
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control...
2
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
4
by: reggiestyles | last post by:
Hi, I've got a question about prototype and event handling. I've got several div's (dynamic number) on a page that I want to set as active or inactive (basically, I'm using scriptaculous'...
2
by: a | last post by:
Hi I have a 3-column listview. It has to return the value of the cell when the user click the listview. The SelectedIndexChanged event and ItemSelectionChanged Event only return the row...
3
by: a | last post by:
Hi, I have a 3-column listview. It has to return the value of the cell when the user click the listview. The SelectedIndexChanged event and ItemSelectionChanged Event only return the row...
1
by: stmfc | last post by:
hi, for an event handling mechanism, we need an event object. (the object where the event actually occur) and we need an event handler, and we need a registration of the event handler to the...
5
by: Klaudiusz Bryja | last post by:
Hi, This is for NetCF 2.0. I need to create event handling code which using reflection. I have some parameters in XML which describe how event should be handled. I have code to create...
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
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,...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...

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.