hi,
pls. tell me how to select value from a check box, & from a list box or combo box.
actually i m new to c# , so sorry for this stupid question but i need your help.
Thanx in advance.
Happy Diwali
Regards
~ Dimple

For checkBox, use Checked and CheckState property.
List and ComboBox; use SelectedValue property.

Comments
good suggestion

The example below will retrieve the value of a checkbox and display it in a messagebox on a button click event.

if (checkBox1.Checked)
            {
                MessageBox.Show(checkBox1.Text.ToString());
            }

It wasn't clear to me whether your question was for obtaining the state, as you have already been directed, or you are wanting to set the state, which I will throw out some additional direction below.

// ListBox method to select an item...
public void SetSelected(int index, bool value);
public ListBox.SelectedObjectCollection SelectedItems { get; } // to see all items selected...
// and, to capture when the selection is changing:
public event EventHandler SelectedIndexChanged;

// RadioButton method to get/set state:
public bool Checked { get; set; }
// and, to capture when the state has been changed:
public event EventHandler CheckedChanged;

// ComboBox methods to select item:
public override int SelectedIndex { get; set; }
public object SelectedItem { get; set; }
// and, to capture when the selection has changed:
public event EventHandler SelectedIndexChanged;

If you search on these, you should be able to find all the example code you need to see/understand how these are implemented in a form.

Cheers!

Edited 7 Years Ago by DdoubleD: n/a

This question has already been answered. Start a new discussion instead.