1

I have timeout functionality built into my application and I am trying to close a FolderBrowserDialog box if that timeout event occurs. Currently I open the dialog like this...

fldBrowse.ShowDialog(Me)

Since the call come from the main form and works it's way through all owned forms I would've expected this case to be handled, but it's not.

I have also tried subscribing to the event and disposing the dialog but this doesn't seem to work either.

Has anyone achieved this in code?

fanuc_bob
  • 857
  • 1
  • 7
  • 20
  • You can use [this code](http://stackoverflow.com/a/12555069/17034), but call it from a timer's Tick event handler instead. – Hans Passant Jun 11 '14 at 16:06

1 Answers1

3

Try this:

AppActivate("Browse For Folder")
SendKeys.SendWait("%{F4}")

This should replicate alt+f4 and close the FolderBrowserDialog

DNKROZ
  • 2,634
  • 4
  • 25
  • 43