mercredi 24 juin 2015

How do I get all checkboxes.text that is selected by a user on C#

Hello again I need help so I came here. I just can't figured out how to do this.

But here's what I want I have a c# form with 6 checkboxes on it. Checkboxes.text value are all Name of programming languages.

[]PHP

[]C

[]C++

[]VB.Net

[]Java

[]C#

Suppose a user click two or more checkboxes how can I display it.

I'm getting confuse on multiple selections part.

Here's my code

For the single selection

   If (Checkbox1.Checked == True)
{
MessageBox.Show(CheckBox1.Text);
}

For two selection

    If (CheckBox1.Checked == True && CheckBox2.Checked == True)
{
MessageBox.Show(CheckBox1.Text);
}

I use If statements on checkboxes for single or even more selected checkboxes.

How can I code it easier or even simplier. Is it possible?




Aucun commentaire:

Enregistrer un commentaire