Click here to Skip to main content
15,891,810 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am developing a very basic desktop application in c#.
I that i have many forms for different operations everything is working fine.
But an issue i am facing is that,
Suppose i open form2, then form3 , them form4.
In taskbar it shows 4 different forms(as applications). So i want that it shouldnt show multiple tasks in taskbar just main form and secondly any orher form could not be opened untill previous form that is curently opened is closed.
Only one form should be open in a time.
How do i implement this strategy? SORRY for code i cant post right now.

What I have tried:

I have no idea about this, i am very beginner to desktop development
Posted
Updated 5-May-18 20:01pm
Comments
BillWoodruff 6-May-18 5:33am    
Why have multiple Forms if you show them "one at a time" ?

I have some ideas (and code to share) on how to manage this, but, before I post, I'd like to know what the roles of the Forms are: is there one main form that is always visible, and the other forms are tool-palettes ... or ... are there multiple independent Forms of the same type ? or ... ?

Sufian Matloob wrote:
and secondly any orher form could not be opened untill previous form that is curently opened is closed.
Only one form should be open in a time.

Based on the description it sounds you want to open the other form as modal. If this is the case then you need to use Form.ShowDialog Method (System.Windows.Forms)[^]

For example
C#
Form2 f2 = new Form2();
f2.ShowDialog(this);

Also as explained in the previous answer, to prevent the form from showing in the taskbar, set the ShowInTaskBar property to false.
 
Share this answer
 
v2
Comments
BillWoodruff 6-May-18 5:35am    
Voted #1

There is nothing in the post suggesting the use of showing a Form modally.

Think before you post.
Wendelius 6-May-18 5:37am    
I have to disagree on that.

The OP wrote "secondly any orher form could not be opened untill previous form that is curently opened is closed." I even included that as a quote in the solution.
BillWoodruff 6-May-18 8:42am    
Okay, I see your point, and that your suggestion is reasonable based on what we know from the OP at this time. I am changing my vote to #5 :)
Wendelius 6-May-18 11:20am    
Thanks :)
You can form your login using Form.ShowInTaskbar Property (System.Windows.Forms)[^].
See -
// Do not allow form to be displayed in taskbar.
myForm.ShowInTaskbar = false;



KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900