Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created 4 forms for enter employee details. first form is user module selection screen. In that i have added 3 checkbox.If user want to view only first 2 form he can checked first two checkbox.So that user can view only first two form not last one and vice versa.according to user select form by clicked on checkbox he can view only this form rest of the form is hidden.i want form to be dispaly according to user select checkbox and hidden form for not selected checkbox.
Posted

1 solution

here you can use CheckedChanged event of checkbox for showing and hiding forms
In that event procedure, implement your logic.


C#
// set Tag properties of each textbox to object of eact form
// e.g 
CheckBox1.Tag = new Form1();CheckBox2.Tag = new Form2();CheckBox3.Tag = new Form3();
//Bind this event procedure to all checkboxes. In CheckedChanged Event write following
CheckboxSelectionChanged(Object sender, EventArgs e)
{
 string FormName=((CheckBox)sender).GetType().Name;
if((CheckBox)sender).Checked)
{

 if(FormName=="Form1")
   (((CheckBox(sender)).Tag) as Form1).Show();
 else if(FormName=="Form2")
    (((CheckBox(sender)).Tag) as Form2).Show();
 . 
 .
 .
}
else
{
  if(FormName=="Form1")
   (((CheckBox(sender)).Tag) as Form1).Close();
 else if(FormName=="Form2")
    (((CheckBox(sender)).Tag) as Form2).Close();
 .
 .
 .
}
}
 
Share this answer
 
v2
Comments
Manohar Khillare 18-Aug-12 2:47am    
i know that but its not simple things.
Sergey Alexandrovich Kryukov 18-Aug-12 3:22am    
If it's not simple for you, and you did even write it, what are you doing in software development? Tried to work as a gas station attendant?
--SA
Sangramsingh Pawar 18-Aug-12 2:52am    
i know developing is not simple thing. You try yourself, if any problem occures we will help you, but no one can give you ready made code.
Kuthuparakkal 18-Aug-12 2:55am    
what makes(click/event) navigation to Form2 Form3 or Form4 from Form1 ? I would like to know if any sequence is there or not.
Manohar Khillare 18-Aug-12 2:57am    
yes in that there is sequence. like form1, form2,form3.every form i added next button to got next page and back button to go to previous page

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