mercredi 27 janvier 2016

How do I get CheckBox Value when checked and when unchecked the value disappear?

I'm using if else statement to show data(value) in the Chart area when my checkbox is checked and data to disappear from chart when I uncheck the checkbox,

I been trying with Visible , enable, checked; however, when I used visible my checkbox disappeared not my data from chart..when its false and if I use enable, I can't click my checkbox when its false.

this is my code, can anyone please help? Is there other way to solve this problem? seriesXOneLine is my chart data Name

        void chkXOneValue_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox chkXOneValue = sender as CheckBox;
        Series seriesXOneLine = new Series();
        seriesXOneLine.ChartType = SeriesChartType.Line;
        chartTrend.Series.Add(seriesXOneLine);
        chartTrend.Series[0].Name = "X1";
        seriesXOneLine.XValueMember = "Row";
        seriesXOneLine.YValueMembers = "X1";
        seriesXOneLine.Color = Color.Blue;
        if (chkXOneValue.CheckState == CheckState.Checked)
        {
            chkXOneValue.Visible = true;      
        }
        else
        {
            chkXOneValue.Visible = false; 
        }

    }




Aucun commentaire:

Enregistrer un commentaire