ComponentOne Input for WinForms
Input for WinForms Task-Based Help / Binding C1CheckBox / Binding C1CheckBox to an Integer Field
In This Topic
    Binding C1CheckBox to an Integer Field
    In This Topic

    To programmatically bind C1CheckBox to an Integer field, use the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    c1CheckBox1.DataSource = dt
    c1CheckBox1.DataField = "ColumnInt"
    c1CheckBox1.DataType = GetType(Integer)
    ‘Use TranslateValues property to translate string values to/from the check box states. 
    c1CheckBox1.TranslateValues.Checked = 1
    c1CheckBox1.TranslateValues.Unchecked = 0
    

    To write code in C#

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