Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

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

On Wed, 30 May 2007 13:19:01 -0700, Ray Mitchell  

<RayMitchell_NOSP@MeanOldTeacher.com> wrote:
> 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

-----------------------------------------------Reply-----------------------------------------------

I didn't realize this property existed.  It's just what I need.  Thanks!
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc