vendredi 24 juillet 2015

C# - How can I write a method to clear a group of checkboxes upon button click?

New C# problem...

I'm supposed to write 4 separate methods to clear 4 groups of checkboxes (all at once) when I click the clear button. I know how to code it with individual checkboxes, but the problem asks for me to create a method and then call it upon clicking the clear button. Help?

I have nothing associated with the clearButton_Click event yet.

    private void ClearOilLube
    {
        set {oilChangeCheckBox.Checked = false;
        lubeJobCheckBox.Checked = false;}
    }

    private void ClearFlushes
    {
        set {radiatorFlushCheckBox.Checked = false; 
        transFlushCheckBox.Checked = false;}
    }

    private void ClearMisc
    {
        set {inspectionCheckBox.Checked = false;
        replaceMufflerCheckBox.Checked = false;
        tireRotationCheckBox.Checked = false;}
    }

    private void ClearOther
    {
        set {partsCostInputTextBox.Text = null;
        laborInputTextBox.Text = null;}
    }

    private void ClearFees
    {
        set {servicesLaborDispLabel.Text = null;
        partsDispLabel.Text = null;
        partsTaxDispLabel.Text = null;
        totalFeesDispLabel.Text = null;}
    }




Aucun commentaire:

Enregistrer un commentaire