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
~ Dimple

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

commented: good suggestion +5

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

if (checkBox1.Checked)

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.


Thanks to all.

how to gridview selected checkbox row send (pass) to same sqldatabase

Please mark this thread as solved, if your problem is solved.......
Thank you..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.