Hi

I have a small app with bound controls that do not seem to be copying across
the data entered into them to the underlying row for the update. This one
really has me stump even though these are very simple steps and I can't see
where I am going wrong. Any help would be appreciated.

The relevant code goes as follows;

Binding controls

Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)

bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)

Adding a new record;

ds.Clients.Clear()
bmCompanyDetails.AddNew()

Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;

Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row

If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If

The Clients table is an MS Access table with ID set to Random Auto number.

Thanks

Regards

Re: Bound controls do not copy across data to underlying data row by W

W
Mon Feb 11 07:25:54 CST 2008

So if I understand correctly, the data will update in the underlying row if
you uncomment that line of code out. If you use yourDataSet.HasChanges(),
what does it return (putting it right before the Update call?). Is it that
when you call Update, it doesn't get sent to the DB?

--
bill.ryan | technology.evangelist | magenic.technologies
mvp - device application development
http://www.msmvps.com/WilliamRyan
http://www.magenic.com
"John" <John@nospam.infovis.co.uk> wrote in message
news:OeXiIK$aIHA.5976@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I have a small app with bound controls that do not seem to be copying
> across the data entered into them to the underlying row for the update.
> This one really has me stump even though these are very simple steps and I
> can't see where I am going wrong. Any help would be appreciated.
>
> The relevant code goes as follows;
>
> Binding controls
>
> Dim db As System.Windows.Forms.Binding
> ds = MyDataset
> db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
> txtID.DataBindings.Add(db)
> db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
> txtCompany.DataBindings.Add(db)
> db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
> txtAddress.DataBindings.Add(db)
>
> bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)
>
> Adding a new record;
>
> ds.Clients.Clear()
> bmCompanyDetails.AddNew()
>
> Some data is entered in the Company and Address bound fields by user and
> Save button is pressed to save as below;
>
> Focus()
> bmCompanyDetails.EndCurrentEdit()
> Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row
>
> If (Row.RowState = DataRowState.Added) Then
> ' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
> stored in datatable so update is working
> daCompanies.Update(ds.Clients)
> End If
>
> The Clients table is an MS Access table with ID set to Random Auto number.
>
> Thanks
>
> Regards
>



Re: Bound controls do not copy across data to underlying data row by John

John
Mon Feb 11 09:40:26 CST 2008

Ryan, it was a binding issue which Miha has kindly solved for me in another
thread.

Many Thanks

Regards

"W.G. Ryan" <WilliamRyan@nospam.gmail.com> wrote in message
news:OpUcoGLbIHA.5208@TK2MSFTNGP04.phx.gbl...
> So if I understand correctly, the data will update in the underlying row
> if you uncomment that line of code out. If you use
> yourDataSet.HasChanges(), what does it return (putting it right before the
> Update call?). Is it that when you call Update, it doesn't get sent to
> the DB?
>
> --
> bill.ryan | technology.evangelist | magenic.technologies
> mvp - device application development
> http://www.msmvps.com/WilliamRyan
> http://www.magenic.com
> "John" <John@nospam.infovis.co.uk> wrote in message
> news:OeXiIK$aIHA.5976@TK2MSFTNGP05.phx.gbl...
>> Hi
>>
>> I have a small app with bound controls that do not seem to be copying
>> across the data entered into them to the underlying row for the update.
>> This one really has me stump even though these are very simple steps and
>> I can't see where I am going wrong. Any help would be appreciated.
>>
>> The relevant code goes as follows;
>>
>> Binding controls
>>
>> Dim db As System.Windows.Forms.Binding
>> ds = MyDataset
>> db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
>> txtID.DataBindings.Add(db)
>> db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
>> txtCompany.DataBindings.Add(db)
>> db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
>> txtAddress.DataBindings.Add(db)
>>
>> bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)
>>
>> Adding a new record;
>>
>> ds.Clients.Clear()
>> bmCompanyDetails.AddNew()
>>
>> Some data is entered in the Company and Address bound fields by user and
>> Save button is pressed to save as below;
>>
>> Focus()
>> bmCompanyDetails.EndCurrentEdit()
>> Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row
>>
>> If (Row.RowState = DataRowState.Added) Then
>> ' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data
>> is stored in datatable so update is working
>> daCompanies.Update(ds.Clients)
>> End If
>>
>> The Clients table is an MS Access table with ID set to Random Auto
>> number.
>>
>> Thanks
>>
>> Regards
>>
>
>