Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:17:50+00:00 2026-06-09T18:17:50+00:00

In C# we can do something like: OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog()

  • 0

In C# we can do something like:

OpenFileDialog dlg = new OpenFileDialog();
  if (dlg.ShowDialog() == DialogResult.OK)
  {
    pbxPhoto.Image = new Bitmap(dlg.OpenFile());
  }

But why can we find out what button was pressed without a listener? Does the program flow stop right before the “if” clause till the open file dialog is closed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:17:52+00:00Added an answer on June 9, 2026 at 6:17 pm

    The ShowDialog() method of the OpenFileDialog class internally handles the button click events, and then returns a DialogResult return type indicating which of the buttons was pressed. (So yes, the method is called synchronously, so flow through your calling method does stop until the dialog returns.).

    You can mimic this behaviour if you write your own modal dialog class (or user control), in which you handle the button click events internally in the dialog class and then provide an enumeration as a result to encapsulate the internal workings of the dialog.

    As an alternative you could add your own handler to the FileOk event, but this would probably make more sense using non modal Show() as per Justin’s answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searching function something like OpenFileDialog on .NET but on win32 , i can't
I know i can do something like ab[^c]+def which should match ab_blah_hi_blah_def but is
I know I can use something like MessageBox.Show(some error) but I'm talking about an
In Java I can do something like the following: TreeMap<Double, String> myMap = new
I'd like to do something really simple with boost::python. I can find documentation for
In Java you can do something like: byte[] code = ReadFromClassFile(SomethingSomething.class); SendAcrossNetwork(code); And on
I know I can use something like User.sort {|a, b| a.attribute <=> b.attribute} or
In Delphi I can do something like: var hWin : HWnd; hWin := GetForegroundWindow;
I know you can do something like this: readlines(FileName) -> {ok, Device} = file:open(FileName,
How I can do something like this in C++: void my_print(format_string) { vector<string> data;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.