making a OpenFileDialog disappear after file selection

  • Thread starter Thread starter Tim Wilson
  • Start date Start date
T

Tim Wilson

I assume that you're talking about a painting issue where you can still see
the dialog because the application hasn't had a chance to repaint yet. Try
calling Application.DoEvents() right after the ShowDialog() method call. But
if you don't need the dialog, then you might want to Dispose() of it first
and then call Application.DoEvents().
 
Greetings,

I am not a Windows Forms developer per se, but I have a question on
OpenFileDialog (and SaveFileDialog) objects.

I invoke the .ShowDialog method on a OpenFileDialog and select my file, easy
enough. But as I start processing the code after the file selection, the
OpenFileDialog box is still showing on the screen... How do I make the
OpenFileDialog go away after I've selected the file and while some other
code is running?

Thanks,

Chris
 
Chris Hayes said:
I am not a Windows Forms developer per se, but I have a question on
OpenFileDialog (and SaveFileDialog) objects.

I invoke the .ShowDialog method on a OpenFileDialog and select my file,
easy enough. But as I start processing the code after the file selection,
the OpenFileDialog box is still showing on the screen... How do I make the
OpenFileDialog go away after I've selected the file and while some other
code is running?

Doesn't the file selection dialog disappear when you choose "Open",
"Cancel", or press the "Close" system button?
 
Hi Herfried,

No, if there is code that is executed after the file selection, the dialog
box stays visible even though it should close.

Chris
 
Back
Top