I have searched around and not found a solution for this, so I am creating a new thread...
I have a number of checkboxes on a form that I would like to databind to columns in my datatable. Each of these columns is a single character string with a value of "Y" or "N" (never null).
I have successfully bound textboxes and comboBoxes with statements like:
this.txtMyTextField.DataBindings.Add("Text", MyDataTable, "MY_TEXT_COLUMN");
this.cmbMyComboBox.DataBindings.Add("SelectedValue", MyDataTable, "MY_CMB_COLUMN");
However, I cannot come up with a solution for checkboxes. I have tried:
this.chkMyCheckBox.DataBindings.Add("Checked", MyDataTable, "MY_Y_N_COLUMN");
but, it seems that the checkbox databinding is making an assumption that the column passed in will always be a boolean.
Is this correct?
Can anyone think of a workaround for this? I will need to do this in a whole bunch of places, so anything that makes it easier is greatly appreciated.
Thanks,
mp
I have a number of checkboxes on a form that I would like to databind to columns in my datatable. Each of these columns is a single character string with a value of "Y" or "N" (never null).
I have successfully bound textboxes and comboBoxes with statements like:
this.txtMyTextField.DataBindings.Add("Text", MyDataTable, "MY_TEXT_COLUMN");
this.cmbMyComboBox.DataBindings.Add("SelectedValue", MyDataTable, "MY_CMB_COLUMN");
However, I cannot come up with a solution for checkboxes. I have tried:
this.chkMyCheckBox.DataBindings.Add("Checked", MyDataTable, "MY_Y_N_COLUMN");
but, it seems that the checkbox databinding is making an assumption that the column passed in will always be a boolean.
Is this correct?
Can anyone think of a workaround for this? I will need to do this in a whole bunch of places, so anything that makes it easier is greatly appreciated.
Thanks,
mp