RowState Question

B

bkunneke

I'm going nuts here trying to figure this out. In a winform, I have a
datagrid bound to a dataset. I want to perform some database updates
when the user edits certain fields of data. Consider the following
code:

If
Me.DsEventLineItemsView.Tables(0).Rows(Me.LastCell.RowNumber).RowState
= DataRowState.Modified Then
..... code here to handle the updated information
End If

My problem is that this only works when the user moves off the datagrid
line. If the user changes a column and DOES NOT move off the line, the
DataRowState is Unchanged. That REALLY SUCKS. What am I missing here?
How can I detect a change WITHOUT the user moving off the line? There
are times when the datagrid only has 1 record in it. These
calculations are lengthy and we don't want to perform them unless the
user has truly changed something. Any help is appreciated.

Bill
 
C

Cor Ligthert [MVP]

Bkunneke,

In version 1.x is the data pushed in the datasource in the way you tell,
which is to force with a endcurrentedit.

By instance in VB.Net with table 0 as datasource/bindingsource

BindingContext(ds.Tables(0)).EndCurrentEdit()

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top