Hi

I am trying to bind a dataview to a number of textboxes, comboboxes and my own control, which contains 2 radio buttons and I am using the currency manager to hold it all together. I bind to the default view of the dataset and i just look at the first row.

I am having problems in that the dataset.haschanges property is set to true when i have not made any changes. I removed the binding of my own control and everything is ok. Does there need to be anything special about the property you bind to?

Code:

In screen close event (I set the position of the currency manager to itself as it seems to help the dataset understand if it has changed):

currencym.Position = currencym.Position
If ds.HasChanges Then 'the dataset has changed
msgbox "Changes have not been saved"

Code to bind the property:

ynQuestion.DataBindings.Add("questionvalue", dv, "question")

Property from control:

Public Property QuestionValue() As Boolean
Get
Return optYes.Checked
End Get
Set(ByVal Value As Boolean)
If Value Then
optYes.Checked = True
Else
optNo.Checked = True
End If
End Set
End Property

Thanks in advance for any help

--------------------------------
From: Malcolm

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>XF2RfTI3ZkewKMzO7Hm+/g==</Id>

Re: binding to a usercontrol by Frans

Frans
Sat May 15 04:11:55 CDT 2004

Malcolm Busfield via .NET 247 wrote:

> Hi
>
> I am trying to bind a dataview to a number of textboxes, comboboxes and my
> own control, which contains 2 radio buttons and I am using the currency
> manager to hold it all together. I bind to the default view of the dataset
> and i just look at the first row.
>
> I am having problems in that the dataset.haschanges property is set to true
> when i have not made any changes. I removed the binding of my own control
> and everything is ok. Does there need to be anything special about the
> property you bind to?
>
> Code:
>
> In screen close event (I set the position of the currency manager to itself
> as it seems to help the dataset understand if it has changed):
>
> currencym.Position = currencym.Position
> If ds.HasChanges Then 'the dataset has changed
> msgbox "Changes have not been saved"
>
> Code to bind the property:
>
> ynQuestion.DataBindings.Add("questionvalue", dv, "question")
>
> Property from control:
>
> Public Property QuestionValue() As Boolean
> Get
> Return optYes.Checked
> End Get
> Set(ByVal Value As Boolean)
> If Value Then
> optYes.Checked = True
> Else
> optNo.Checked = True
> End If
> End Set
> End Property
>
> Thanks in advance for any help
>
Do you have by any chance an eventhandler defiend on optYes.CheckedChanged?
If so, it gets fired when yuo set the checked value in code as well.

FB


--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP