mardi 21 avril 2020

One of the Four Check box not Working in C#

I've written a code in which when one check box is clicked the others get disselected image of buttons
3 of my check boxes are working fine byname,containing and bydate But when I try to do the same with the by category check box I get the following message.error image This is my code

 private void vieworder_Load(object sender, EventArgs e)
{
    try
    {
        con.Open();
        if (con.State == ConnectionState.Open)
        {
            lblstatus.Text = "Connected";
            lblstatus.ForeColor = Color.Green;
        }
        else
        {
            lblstatus.Text = "Not-Connected";
            lblstatus.ForeColor = Color.Red;
        }
        showdtgrid();



    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }

}

private void hidecheckbox()
{
    chkboxbyname.CheckState = CheckState.Unchecked;
    chkboxbydate.CheckState = CheckState.Unchecked;
    chkboxcontaining.CheckState = CheckState.Unchecked;
    checkBox1.CheckState = CheckState.Unchecked;

}





private void chkboxbyname_CheckedChanged(object sender, EventArgs e)
{
        hidecheckbox();

        chkboxbyname.CheckState = CheckState.Checked;

}

private void chkboxcontaining_CheckedChanged(object sender, EventArgs e)
{

        hidecheckbox();

    chkboxcontaining.CheckState = CheckState.Checked;

}

private void chkboxbydate_CheckedChanged(object sender, EventArgs e)
{

        hidecheckbox();

    chkboxbydate.CheckState = CheckState.Checked;


}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
    hidecheckbox();
    checkBox1.CheckState = CheckState.Checked;
}


   }

}

Please tell me what's wrong




Aucun commentaire:

Enregistrer un commentaire