locked
Is it possible to display an active form on top of a modal form RRS feed

  • Question

  • Is it possible to show a clickable form on top of a modal form displayed using ShowDialog() ?

    Desc : My App has a form1 which is opened through a button click on parent form. On clicking Fullscreen button form2 is opened as a modal dialog (ShowDialog()). Is there any possibility to make Form1 acitve (Clickable) on top of Form2. The Form2 cannot be Modal less dialog(Show()) as per my requirements.

    Monday, April 18, 2011 5:21 PM

Answers

  • Is it possible to show a clickable form on top of a modal form displayed using ShowDialog() ?

    Desc : My App has a form1 which is opened through a button click on parent form. On clicking Fullscreen button form2 is opened as a modal dialog (ShowDialog()). Is there any possibility to make Form1 acitve (Clickable) on top of Form2. The Form2 cannot be Modal less dialog(Show()) as per my requirements.


    Why do you want to make the Form1 active when form2 already show as a modal dialog? There are incompatible. You don't need to set form2 as modal dialog form, just to set form2's topmost to true will make the form2 at the top also the form1 is clickable. Code snippet:

            private void button2_Click(object sender, EventArgs e)

            {

                Form1 frm2 = new Form1();

                frm2.Show();

                frm2.TopMost = true;

            }

     


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Proposed as answer by Helen Zhou Tuesday, April 26, 2011 1:28 AM
    • Marked as answer by Helen Zhou Monday, May 2, 2011 9:05 AM
    Thursday, April 21, 2011 3:31 AM

All replies

  • No. I don't think you can access Form1 until you close Form2 opened using ShowDialog.
    Gaurav Khanna
    Monday, April 18, 2011 6:09 PM
  • You can try Me.TopMost = true

    Adam


    Ctrl+Z
    Monday, April 18, 2011 6:12 PM
  • Me.TopMost = true makes the form click-able?
    Monday, April 18, 2011 6:16 PM
  • Is there any work around to achieve the functionality..


    Rachna
    Monday, April 18, 2011 6:18 PM
  • I think who ever is giving you your requirements doesnt know what modal means if the requirment is to show the form underneath.

    I think your options are as follows:

    1. Go back to the person who says "I want modal AND have access to the parent form" and club them to death with a copy of Petzolds
    2. Try and implement your own type of "Modal" behaviour in the form itself, forcing itself to be topmost unless a flag is set. So use Show instead of ShowDialog.

     

    I think option 1 is best.


    Thanks

    Dark

     

    Tuesday, April 19, 2011 8:45 AM
  • Is it possible to show a clickable form on top of a modal form displayed using ShowDialog() ?

    Desc : My App has a form1 which is opened through a button click on parent form. On clicking Fullscreen button form2 is opened as a modal dialog (ShowDialog()). Is there any possibility to make Form1 acitve (Clickable) on top of Form2. The Form2 cannot be Modal less dialog(Show()) as per my requirements.


    Why do you want to make the Form1 active when form2 already show as a modal dialog? There are incompatible. You don't need to set form2 as modal dialog form, just to set form2's topmost to true will make the form2 at the top also the form1 is clickable. Code snippet:

            private void button2_Click(object sender, EventArgs e)

            {

                Form1 frm2 = new Form1();

                frm2.Show();

                frm2.TopMost = true;

            }

     


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Proposed as answer by Helen Zhou Tuesday, April 26, 2011 1:28 AM
    • Marked as answer by Helen Zhou Monday, May 2, 2011 9:05 AM
    Thursday, April 21, 2011 3:31 AM
  • You want Form2 Modal, but not to Form1?  Show Form2 modally in a different thread.
    Thursday, April 21, 2011 7:49 AM
  • Hi rmevawala,

    If you feel the solution I gave doesn’t real answer your question, please feel free to unmark it and update the thread.

    Sincerely,


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 2, 2011 9:06 AM