select value from check box

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2009
Posts: 27
Reputation: kool.net is an unknown quantity at this point 
Solved Threads: 0
kool.net kool.net is offline Offline
Light Poster

select value from check box

 
0
  #1
Oct 16th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,710
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 483
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven
 
1
  #2
Oct 16th, 2009
For checkBox, use Checked and CheckState property.
List and ComboBox; use SelectedValue property.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 28
Reputation: sanch01r is an unknown quantity at this point 
Solved Threads: 2
sanch01r sanch01r is offline Offline
Light Poster
 
0
  #3
Oct 18th, 2009
The example below will retrieve the value of a checkbox and display it in a messagebox on a button click event.
  1. if (checkBox1.Checked)
  2. {
  3. MessageBox.Show(checkBox1.Text.ToString());
  4. }
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 940
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 154
DdoubleD DdoubleD is offline Offline
Posting Shark
 
1
  #4
Oct 18th, 2009
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.

  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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 27
Reputation: kool.net is an unknown quantity at this point 
Solved Threads: 0
kool.net kool.net is offline Offline
Light Poster
 
0
  #5
Oct 19th, 2009
Hey
Thanks to all.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 3
Reputation: miracle007 is an unknown quantity at this point 
Solved Threads: 1
miracle007 miracle007 is offline Offline
Newbie Poster
 
1
  #6
Oct 20th, 2009
how to gridview selected checkbox row send (pass) to same sqldatabase
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 213
Reputation: avirag is an unknown quantity at this point 
Solved Threads: 15
avirag avirag is offline Offline
Posting Whiz in Training
 
0
  #7
Oct 20th, 2009
Please mark this thread as solved, if your problem is solved.......
Thank you..
Reply With Quote Quick reply to this message  
Reply

Tags
box, check, combo, listbox

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for box, check, combo, listbox
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC