ComponentOne Input for WinForms
Binding C1CheckBox to a String Field
Input for WinForms Task-Based Help > Binding C1CheckBox > Binding C1CheckBox to a String Field

To programmatically bind C1CheckBox to a String field, use the following code:

To write code in Visual Basic

Visual Basic
Copy Code
c1CheckBox1.DataSource = dt
c1CheckBox1.DataField = "ColumnString"
c1CheckBox1.DataType = GetType(String)
' Use TranslateValues property to translate string values to/from the check box states. 
c1CheckBox1.TranslateValues.Checked = "Yes"
c1CheckBox1.TranslateValues.Unchecked = "No"

To write code in C#

C#
Copy Code
c1CheckBox1.DataSource = dt;
c1CheckBox1.DataField = "ColumnString";
c1CheckBox1.DataType = typeof(string);
// Use TranslateValues property to translate string values to/from the check box states. 
c1CheckBox1.TranslateValues.Checked = "Yes";
c1CheckBox1.TranslateValues.Unchecked = "No";
See Also