Hi everyone,

I have four forms. Form1 is the main form and needs to be kept open and visible at all times but cannot be clicked while the other forms are open. For example, the main form is open and after a certain amount of time the second form opens in front of it (and the main form is still visible). Then I click on a button on the second form to open a third form and the main form minimises and is not visible to the user while the third form only is visible to the user. I need the main form to remain open and visible in the background when the user is using the other forms. I have tried using this.visible = true but I cannot get the main form to stay visible.

Does anyone have any ideas as to how I might be able to overcome this problem? thanks in advance.

SubProf

Recommended Answers

All 4 Replies

just make sure not to call form.Hide()

you might also show other forms as dialogs depending on your needs

go to main form's properties and set ismdicontainer=true
and then for every form's (object when created and called to form.show() before that set the form's mdiparent to the main form) for e.g.
form1 obj=new form1();
obj.mdiparent=mainform

I guess it depends a little why you would have such a structure, however, if the forms have to remain forms, but work except the main form, you can of course disable it.. and have a counter so that when you close the other forms, they decrease the counter so that you can then use the main form when and only when all the blocking forms have closed.

The bad side of that is you would also need to be careful come the windows shutdown message

go to main form's properties and set ismdicontainer=true
and then for every form's (object when created and called to form.show() before that set the form's mdiparent to the main form) for e.g.
form1 obj=new form1();
obj.mdiparent=mainform

Thanks viswa_007 - that worked!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.