bind data to check box cell type

Posted by: thesilentkill on 8 September 2017, 2:18 pm EST

  • Posted 8 September 2017, 2:18 pm EST

    How do i bind data to a check box cell type? I create the column (and checkbox celltype) at runtime

    Dim chk As New CellType.CheckBoxCellType

    .Columns(i).CellType = chk

    .Columns(i).HorizontalAlignment = CellHorizontalAlignment.Center

     then bind data into it afterwards (the column is numeric, but returns 1 or 0). What happens is that the sheet column  becomes an ordinary column, with data being shown as 1.00 or 0.00. 

  • Replied 8 September 2017, 2:18 pm EST


    You need to set DataAutoCellTypes property of the sheet to false and then try setting the CellType of Column. Here is the code to achieve the above stated functionality wherein numeric column in database is bound to Checkbox CellType in Spread.


                string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\BoundDataAndCheckbox\\MyDataBase.mdb";
                OleDbConnection con = new OleDbConnection(connectionString);
                string qstringCustomers = "SELECT * FROM Customers";
                dt = new DataTable();
                adapterCustomers = new OleDbDataAdapter(qstringCustomers, con);
                cmd1 = new OleDbCommandBuilder(adapterCustomers);
                adapterCustomers.UpdateCommand = cmd1.GetUpdateCommand();
                fpSpread1.DataSource = dt;
                fpSpread1.ActiveSheet.DataAutoCellTypes = false;
                FarPoint.Win.Spread.CellType.CheckBoxCellType chk = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
                fpSpread1.ActiveSheet.Columns[1].CellType = chk;
            private void button1_Click(object sender, EventArgs e)        // to update DataBase
                foreach (DataRow row in (fpSpread1_Sheet1.DataSource as DataTable).Rows)


    Please have a look and let us know your further observations on the same. Hope this will help you.


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels