Articles in this section
Category / Section

How can we bind a CheckBoxAdv to a field (containing only 0 or 1) column in a Datatable ?

1 min read

 

You can bind a CheckBoxAdv to a field (containing only 0 or 1) column in a Datatable as shown below:

C#

DataTable m_tbl =new DataTable();

m_tbl.Columns.Add("ID", typeof(int));

m_tbl.Columns.Add("ValueStr", typeof(string));

m_tbl.LoadDataRow(new object[] {0, "Y"}, true);

m_tbl.LoadDataRow(new object[] {1, "N"}, true);

this.checkBoxAdv1.DataBindings.Add("IntValue", m_tbl , "ID");

VB

Private m_tbl As DataTable = New DataTable()

m_tbl.Columns.Add("ID", GetType(Integer))

m_tbl.Columns.Add("ValueStr", GetType(String))

m_tbl.LoadDataRow(New Object() {0, "Y"}, True)

m_tbl.LoadDataRow(New Object() {1, "N"}, True)

Me.checkBoxAdv1.DataBindings.Add("IntValue", m_tbl, "ID")

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied