Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a checklist box in form1 (Sq), if specific items have been selected i want the title of form2 (Ops) to change.


is this possible.


Form1 code:
Operations Ops = new Operations();
Ops.Show();



Form2 code:

if  (Ops.CustLB.CheckBox > 0&1&2&3&4)
                    {
    PgeTitleLbl.Text = "Wax Injection Process";

}


Is this possible? I am very new to C#

What I have tried:

Form2 code:

<pre>            if  (Ops.CustLB.CheckBox > 0&1&2&3&4)
                                {
                PgeTitleLbl.Text = "Wax Injection Process";
                
            }
Posted
Updated 10-Apr-18 0:41am
v2

1 solution

Assuming this is a WinForm project, and that 'Op is the Main Form, Form1, and it creates the instance of the other Form, Form2:

1. Define a Public method in Form2:
C#
public void SetForm2Title(string title)
{
    PgeTitleLbl.Text = title;
}
2. in Form1, in your CheckedListBox index changed handler, invoke the method in Form2 as necessary:
C#
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    if(??????)
    {
         SetForm2Title("Wax Injection Process");
    } else if(??????)
    {
         // ????
    }
}
 
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