Hello,
I need help with checkboxes.
I have a field (nvarchar) in a table on SQL Server and i want to return values in a checkbox.
For example if field="H" then checkbox=checked.
The same goes with insert and edit. If the user checks the checkbox i want to save field="H" on the table.
Any suggestions?
Thank you in advance.
How to retrieve data to checkbox
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Sep 1, 2009, 8:07 AM EDT
DealyRank #9,518 · 205 reputationPosted Sep 2, 2009, 12:13 AM EDT
TextBox temp_No = new TextBox(); temp_No.DataBindings.Add("Text", binBindSource, "CHECK_NO"); if (temp_No.Text == "1") check_no.CheckState = System.Windows.Forms.CheckState.Checked; else check_no.CheckState = System.Windows.Forms.CheckState.Unchecked;check_no is a checkbox.
The problem is that I always get null as a result of temp_no.
I do something similar when inserting/updating the record and i have no problem. It saves value 1 if the checkbox is checked and value 0 if it's not.