Hi All,

I am under the impression that databinding allows a control to be updated
automatically by the interface when the underlying value changes. However,
many of my controls will not update after the initial display. If I have a
boolean property and I bind it to a checkbox's checked property, I should be
able to change the boolean from true to false and observe the checkbox go
from checked to unchecked. Is there something else I should be doing or am I
totally off-base?
--
Thanks,
Harry

Re: Databinding w/Update by Norman

Norman
Mon Apr 18 14:36:41 CDT 2005

Are you talking about Win Form App? If yes, showing some code may help to
see what happens.

"Harry Riddle" <NetStream@newsgroup.nospam> wrote in message
news:5880E953-7BC5-4AF6-A54B-B67E709D415B@microsoft.com...
> Hi All,
>
> I am under the impression that databinding allows a control to be updated
> automatically by the interface when the underlying value changes.
However,
> many of my controls will not update after the initial display. If I have
a
> boolean property and I bind it to a checkbox's checked property, I should
be
> able to change the boolean from true to false and observe the checkbox go
> from checked to unchecked. Is there something else I should be doing or
am I
> totally off-base?
> --
> Thanks,
> Harry



RE: Databinding w/Update by v-phuang

v-phuang
Tue Apr 19 00:07:05 CDT 2005

Hi Harry,

Here is some code for your reference.
private bool bChecked;
public bool MyChecked
{
set{bChecked = value;}
get{return bChecked;}
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.DataBindings.Add("MyChecked",this.checkBox1,"Checked");
this.checkBox1.CheckedChanged+=new
EventHandler(checkBox1_CheckedChanged);
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.Text = MyChecked.ToString();
}

Also here is a link you may take a look.
http://groups.google.co.jp/groups?hl=zh-CN&lr=&threadm=1d438033.0404210520.2
5a73e87%40posting.google.com&rnum=5&prev=/groups%3Fhl%3Dzh-CN%26lr%3D%26q%3D
%2522checkBox1.DataBindings.Add%2522


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Re: Databinding w/Update by Dmytro

Dmytro
Tue Apr 19 01:13:40 CDT 2005

Hi Harry,

For the databinding to work properly, each bindable property on a class or
on a component must be complemented with an event of type EventHandler. This
event must be named <Property>Changed, where <Property> is the name of your
property. E.g. if your property is named IsAvailable, the event must be
named IsAvailableChanged.

This applies if your properties are real properties and not 'virtual' ones
exposed through ICustomTypeDescriptor.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


"Harry Riddle" <NetStream@newsgroup.nospam> wrote in message
news:5880E953-7BC5-4AF6-A54B-B67E709D415B@microsoft.com...
> Hi All,
>
> I am under the impression that databinding allows a control to be updated
> automatically by the interface when the underlying value changes.
> However,
> many of my controls will not update after the initial display. If I have
> a
> boolean property and I bind it to a checkbox's checked property, I should
> be
> able to change the boolean from true to false and observe the checkbox go
> from checked to unchecked. Is there something else I should be doing or
> am I
> totally off-base?
> --
> Thanks,
> Harry


Re: Databinding w/Update by dch

dch
Wed May 25 10:52:18 CDT 2005

I have the same problem and can't figure out what to do.
I have a window application with a textbox(VS2003). I set the databinding
property, text, of the textbox to one of the column of the dataset.
I assume when I change the textbox value, it will update the column of the
table automatically. When it does not update the table, I added code in the
textchange method of the textbox to do an update, such as:
oleDBDataAdapter1.Update(dataSet1);
and it still does not update the table.
Does anyone have any clue how to make this work?

"Dmytro Lapshyn [MVP]" wrote:

> Hi Harry,
>
> For the databinding to work properly, each bindable property on a class or
> on a component must be complemented with an event of type EventHandler. This
> event must be named <Property>Changed, where <Property> is the name of your
> property. E.g. if your property is named IsAvailable, the event must be
> named IsAvailableChanged.
>
> This applies if your properties are real properties and not 'virtual' ones
> exposed through ICustomTypeDescriptor.
>
> --
> Sincerely,
> Dmytro Lapshyn [Visual Developer - Visual C# MVP]
>
>
> "Harry Riddle" <NetStream@newsgroup.nospam> wrote in message
> news:5880E953-7BC5-4AF6-A54B-B67E709D415B@microsoft.com...
> > Hi All,
> >
> > I am under the impression that databinding allows a control to be updated
> > automatically by the interface when the underlying value changes.
> > However,
> > many of my controls will not update after the initial display. If I have
> > a
> > boolean property and I bind it to a checkbox's checked property, I should
> > be
> > able to change the boolean from true to false and observe the checkbox go
> > from checked to unchecked. Is there something else I should be doing or
> > am I
> > totally off-base?
> > --
> > Thanks,
> > Harry
>
>