Hi Kevin.
I tried your code and it worked fine.. thanks a lot.
I'm not sure though that I understand why my orignal code did not work.
In VFP, if you specify the ControlSource of an object, it doesnt matter if its a TextBox or a CheckBox.....nothing different needs to be done.
Why this special code in DotNet for a CheckBox... and do I need to do something different also for other types of controls (Radio Buttons,RichTextBoxes,Date-time fields etc)
For instance , to databind a Tel No I Have code like:
this.txtTel.DataBindings.Add("Text",this.dsIFSR,"IFISR.isr_tel");
Why then doed this not work ?
this.txtMyChk.DataBindings.Add("Text",this.dsIFSR,"IFISR.isr_MyChkel");
I reckon its to do with having to bind a 'CheckBox' type to a CheckBox property
Is there any good article around on the area of Binding ?
Regards,
Gerard
>Hey, Gerard,
>
>You need to do a couple of things...
>
>First, you need to bind to the Checked property of the checkbox, like so...
>
>
>System.Windows.Forms.Binding chkBinding;
>chkBinding = new System.Windows.Forms.Binding("Checked",
> MyDataSet , "MyTable.MyFlag");
>
>chkBinding.Format += new ConvertEventHandler(this.CheckBoxHandler);
>chkEmployee.DataBindings.Add(chkBinding);
>
>
>Note the reference to "CheckBoxHandler"...it's there to handle null values...
>
>
>private void CheckBoxHandler(object sender, ConvertEventArgs e)
>{
> if (e.Value == DBNull.Value)
> e.Value = false;
>}
>
>
>Let me know if that helps...
>Kevin