Form / Dataset Changes

M

Mitchell Vincent

I have the follow function for detecting when my bound dataset has
changed (by the user, I hope).


Public Function HasFormChanges() As Boolean

Dim row As DataRow
Dim i As Integer = 0

For i = 0 To (Me.DataTable.Rows.Count - 1)

row = Me.DataTable.Rows(i)

Select Case row.RowState

Case DataRowState.Added
Return True

Case DataRowState.Modified
Return True

Case DataRowState.Deleted
Return True

End Select

Next

Return False

End Function


However, now that I know *something* has changed, I'd like to know what.
Is there any way for me to know what column header holds the value that
is added, modified or deleted?
 
C

Cor Ligthert

Mitchell,

With a lot of saving and using reject changes probably you can, however what
it the reason you want this. Should you not tackle the user direct at the
begin?

Cor
 
P

Peter Huang [MSFT]

Hi

Have you tried to take a look at the DataTable event?
DataTable.ColumnChanged Event
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatatableclasscolumnchangedtopic.asp

Working with DataTable Events
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconworkingwithdatatableevents.asp

Is this what you want? If you still have any concern, please feel free to
post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mitchell Vincent

Cor said:
Mitchell,

With a lot of saving and using reject changes probably you can, however what
it the reason you want this. Should you not tackle the user direct at the
begin?

Cor

Actually, that function is returning changes as soon as the form is
loaded and I have no idea why. I was going to see if I could find out
*what* column was holding the changed data so I could track down where
it is being changed and why.
 

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