Closing OpenFileDialog programmatically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aagarwal8@gmail.com

    Closing OpenFileDialog programmatically

    Hi,

    When the OpenFileDialog is opened on one of my forms, i can trigger
    the close of the second form from my primary form. (Plz note, both the
    forms are running on different threads). However, as long as the File
    dialog is opened, it won't let the secondary form close. So I need to
    close the OpenFileDialog programatically . I couldn't find a close
    method on OpenFileDialog, and the dispose method just wont close it.

    Any ideas how this can be done?

    Regards,
    Ankit!
  • aagarwal8@gmail.com

    #2
    Re: Closing OpenFileDialog programmaticall y

    Folks....need your help!!!

    any way out??? Win32 calls, unmanaged, managed calls, anything?????

    Comment

    • Peter Duniho

      #3
      Re: Closing OpenFileDialog programmaticall y

      On Tue, 06 May 2008 23:52:30 -0700, <aagarwal8@gmai l.comwrote:
      Folks....need your help!!!
      >
      any way out??? Win32 calls, unmanaged, managed calls, anything?????
      You could probably use unmanaged code to do what you want. Find the
      appropriate window, send it WM_CLOSE or simulate hitting the cancel button
      or whatever.

      But, why? The UI you're proposing sounds awkward and user-unfriendly.
      It's generally rude to close windows on the user without their explicit
      action. And in this case, "their explicit action" would be them closing
      the dialog themselves.

      I admit, there's some tiny possibility that you have some bizarro
      situation that's the one legitimate reason for doing this, as compared to
      the innumerable situations where someone might think they want to do this
      but would be wrong. But frankly, I've seen too many user interfaces
      written with this sort of violation of the "rule of least surprise" to
      think that you have come up with that miracle instance of a legitimate
      reason to close the user's dialog without their involvement.

      More likely, you need to rethink your UI so that you don't have a need to
      close the OpenFileDialog programmaticall y.

      Pete

      Comment

      • Alex Petrov

        #4
        Re: Closing OpenFileDialog programmaticall y

        Hi,

        You can use our Dialog Workshop .NET components.

        CaOpenFileDialo g and CaSaveFiledialo g components have CloseDialog method
        which you can use to close dialogs programmaticall y.

        Please visit http://www.componentage.com for details.

        Best regards,
        Alexander Petrov
        COMPONENTAGE Software



        <aagarwal8@gmai l.com>:

        news:831ec15c-d454-412d-92bd-59ff565a9168@t1 2g2000prg.googl egroups.com...
        Folks....need your help!!!
        >
        any way out??? Win32 calls, unmanaged, managed calls, anything?????

        Comment

        Working...