-1

I have three forms (Form1, Form2, Form3), and my need would be:

Form1 opens Form2 with .Show(), without freezing Form1.

Form2 opens Form3 with .ShowDialog() without freezing Form1.

I tried passing the owner inside the .Show(this) and .ShowDialog(this)

Mustafa Özçetin
  • 1,893
  • 1
  • 14
  • 16
  • 1
    The Modal state set by ShowDialog is meant to block the application not a (certain) form. If you want something like that you need to use Show and disable the parent then yourself and maintain that state somehow if needed to correctly enable that form again. – Ralf Jul 28 '23 at 13:13
  • https://stackoverflow.com/a/5183623/17034 – Hans Passant Jul 28 '23 at 13:27

1 Answers1

2

There are many differences when using Form.Show() and Form.ShowDialog().

Form.Show() Form.ShowDialog()
Form.Show(): When using Form.Show(), the form appears as a non-blocking window, allowing users to interact with other forms simultaneously. Form.ShowDialog(): With Form.ShowDialog(), the form displays as a modal dialog, preventing interaction with other forms until it's closed.
Code Execution: Form.Show(): The calling code continues execution immediately after showing the form. Code Execution: Form.ShowDialog(): Code execution in the calling method pauses until the modal dialog is closed.
Return Value: Form.Show(): Doesn't return a specific value related to the form. Return Value: Form.ShowDialog(): Returns a value indicating the user's action in the dialog.
Parent-Child Relationship: Form.Show(): The form is not automatically a child of the calling form. Parent-Child Relationship: Form.ShowDialog(): The form is always a child of the calling form.
Usage Scenario: Form.Show(): Ideal for non-blocking interactions and simultaneous use of multiple forms. Usage Scenario: Form.ShowDialog(): Used for critical actions requiring user input or confirmation.

I'm not entirely certain I fully understand your question, but based on my understanding, it seems like you can't use Form.ShowDialog() or Form.ShowDialog(owner) without freezing other forms. You've to use Form.Show() or Form.Show(owner) instead. If I'm mistaken or if you could provide more clarification, I'd be glad to revise my answer accordingly.