Hi Arne,
[quoted text, click to view] "Arne" <Arne@discussions.microsoft.com> wrote in message
news:30BFA6FD-082A-4597-BAF1-CC867C5BAD77@microsoft.com...
> Bart,
> This code works fine
> >
> This code doesn't work
Did you first call EndCurrentEdit ? Like :
'
' bind
'
SubClassDescription.DataBindings.Add( "Text", data.Tables(0), "SomeField" )
'
' check for changes (notice the same DataSource used for
' BindingContext as the one that was used for the binding.)
'
BindingContext( data.Tables(0) ).EndCurrentEdit()
If ( Not data.Tables(0).GetChanges() Is Nothing ) Then
' datatable has changes
MessageBox.Show("DT has changes")
End If
[quoted text, click to view] > Thanks
> Arne
If this doesn't help you'll need to provide more information , like all
relevant code that reproduces the problem.
HTH,
Greetings
[quoted text, click to view] >
> "Bart Mermuys" wrote:
>
>> Hi,
>>
>> "Arne" <Arne@discussions.microsoft.com> wrote in message
>> news:C00B86D9-2BE6-437D-B44B-89DD5AE868C3@microsoft.com...
>> > Databinding works only one way
>> > da.Fill(data, "SubClass")
>> > SubClassDescription.DataBindings.Clear()
>> > SubClassDescription.DataBindings.Add("text", data.Tables(0) ,
>> > "SubClassDescription")
>> >
>> > Putting the edits back into the data source doesn't work!
>>
>> No, you're asking for the wrong BindingManagerBase. You need to specify
>> exactly the same DataSource and DataMember(excluding field so it can be
>> an
>> empty string and may be omitted) as the ones you used for the binding.
>> So
>> in your case that would be:
>>
>> Dim manager As BindingManagerBase
>> manager = Me.BindingContext( data.Tables(0) )
>> manager.EndCurrentEdit()
>>
>> subclass = row.ItemArray(0)
>>
>> >
>> > How can I get databinding to work? All I want to do is to separate data
>> > before and after edits so that I can determine if I need to update the
>> > database.
>>
>> You could use :
>> If ( Not data.Tables(0).GetChanges() Is Nothing ) Then
>> ' datatable has changes
>> End If
>>
>> HTH,
>> Greetings
>>
>>
>>
>>