Articles in this section
Category / Section

How do we use bool values for databinding?

1 min read

 

If we want to use bool values for databinding, then use the CheckBoxAdv's BoolValue property for this purpose.

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, "false"}, true);

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

this.checkBoxAdv1.DataBindings.Add("BoolValue",m_tbl , "ValueStr");

VB

Private m_tbl As DataTable = New DataTable()

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

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

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

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

Me.checkBoxAdv1.DataBindings.Add("BoolValue", m_tbl, "ValueStr")

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