views:

368

answers:

5

language c#, winform

how do i create a modal window or such a thing that when it still showing i would still be able to click or interact with the main window..

thanks.

put some code please or links..

A: 

Modality by definition means that you are not able to click anywhere else. You can create another form and show it with Show() method.

Nikolay R
+1  A: 

Make the dialog non-modal (use Show instead of ShowDialog), and make it top-most (TopMost = true)

Thomas Levesque
+1  A: 

Just use the overload of Form.Show() that takes a form as a parameter, like this:

Form f = new Form();
f.Show(this);

This will keep the form always on top of the form that calls it, but still let you click and access the calling form.

MusiGenesis
i ve got problem with this f.show(), i have richtextbox inside the form, and when I close the form, it disposed the form along with the richtextbox, so when i try to write something likie rtextbox.txt="some text" after i close the form, it will break my program
r4ccoon
@r4ccoon: not sure I understand your problem. Why would you want to set a RichTextBox's Text property *after* the form it's on has been closed?
MusiGenesis
ok. so in my code i have Console.writeln("debug thing"); this comman will also insert values into a rich text box. when i double click anywhere on my window, the program will showing a rich text box with "debung thing". and also all the consolewriteln that i have been put all over my codes as for debugging. with showDialog() i am able to "keep" the value inside the rich text box after it is closed. but with show() after i close the window, apparently it also delete the richtextbox instance.
r4ccoon
A: 

Show() Method allows you to click anywhere while ShowDialog() won't

Sherwin Valdez
A: 

Some confusion here I think;

Modal is when the window blocks the underlying window, and must be closed to enable the underlying window to regain control. Form.ShowDialog(owner) is used to accomplish this.

Non-Modal is a window that is opened "in parallell" to the underlying window. Both windows can be accessed and respond to mouse and key events. Form.Show(owner) to accomplish this.

sindre j