944,123 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 4251
  • C# RSS
Oct 16th, 2009
0

select value from check box

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
kool.net is offline Offline
28 posts
since Oct 2009
Oct 16th, 2009
1
Re: select value from check box
For checkBox, use Checked and CheckState property.
List and ComboBox; use SelectedValue property.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Oct 18th, 2009
0
Re: select value from check box
The example below will retrieve the value of a checkbox and display it in a messagebox on a button click event.
C# Syntax (Toggle Plain Text)
  1. if (checkBox1.Checked)
  2. {
  3. MessageBox.Show(checkBox1.Text.ToString());
  4. }
Reputation Points: 10
Solved Threads: 3
Light Poster
sanch01r is offline Offline
30 posts
since Oct 2009
Oct 18th, 2009
1
Re: select value from check box
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.

C# Syntax (Toggle Plain Text)
  1. // ListBox method to select an item...
  2. public void SetSelected(int index, bool value);
  3. public ListBox.SelectedObjectCollection SelectedItems { get; } // to see all items selected...
  4. // and, to capture when the selection is changing:
  5. public event EventHandler SelectedIndexChanged;
  6.  
  7. // RadioButton method to get/set state:
  8. public bool Checked { get; set; }
  9. // and, to capture when the state has been changed:
  10. public event EventHandler CheckedChanged;
  11.  
  12. // ComboBox methods to select item:
  13. public override int SelectedIndex { get; set; }
  14. public object SelectedItem { get; set; }
  15. // and, to capture when the selection has changed:
  16. 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!
Last edited by DdoubleD; Oct 18th, 2009 at 1:12 pm.
Reputation Points: 341
Solved Threads: 233
Posting Shark
DdoubleD is offline Offline
984 posts
since Jul 2009
Oct 19th, 2009
0
Re: select value from check box
Hey
Thanks to all.
Reputation Points: 10
Solved Threads: 0
Light Poster
kool.net is offline Offline
28 posts
since Oct 2009
Oct 20th, 2009
1
Re: select value from check box
how to gridview selected checkbox row send (pass) to same sqldatabase
Reputation Points: 10
Solved Threads: 1
Newbie Poster
miracle007 is offline Offline
3 posts
since Oct 2009
Oct 20th, 2009
0
Re: select value from check box
Please mark this thread as solved, if your problem is solved.......
Thank you..
Reputation Points: 31
Solved Threads: 36
Posting Whiz
avirag is offline Offline
312 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: select value from datagrid
Next Thread in C# Forum Timeline: Web browser component help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC