ADO RowState problem

B

BK

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
 
S

Steven Nagy

Perhaps you could use the DataGrid's CurrentCellChanged event.
This would only fire if the user changes something.
So you don't need to do a state check on your row.
You already know once that event is handled that the current cell has
indeed changed and needs calculations.
 
C

Cor Ligthert [MVP]

BK,

Will you please be so kind not to multipost, I have given an answer in
another newsgroup on this question. Crossposting is no problem which is
sending one message to more newsgroups.

Cor
 
B

BK

Thanks for the reply. I am using the DataGrid's CurrentCellChanged
event. That event fires anytime the user moves from cell to cell,
regardless of wheter they've changed anything. What I need is an event
that truly signals if a cell has changed. Any other thoughts?

BTW, I'm sorry about posting to 2 newsgroups, I didn't realize that was
improper netiquette.
 

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