rowchanging or column changing events

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Hi hopefully someone can clear me up on these issues.

What I have is a dataset with a single table in it. At this point all I'm
doing is binding textboxes to the data and have a datacontrol to move
between the records.
I would like to know weather or not any data within this row has changed
since last save.
I wrote a couple of handles but each are not performing as I would expect.

AddHandler Activity's.Tables("activities").Row, AddressOf
Categories_RowChanging

This fires everytime I move to next record. I would only like to know if
the row itself is changing, or something in it is changing.



AddHandler ActivityDS.Tables("activities").ColumnChanging, AddressOf
Me.Categories_ColumnChanging

This fires every column even if i'm clicking on a different text box and
nothing changed in previous box, as well as firing for every column in table
when moving to next record.

I only want to know if the current rows.column is being changed not for
moving from one record to another.



Can someone tell me the best way to handle what we are trying to do without
writing a bunch of code for each textbox we have on the edit screen?

By the way I'm connecting and populating all datasets and tables via runtime
code using sqlclients if that makes any difference.

TIA

Scott
 
additional testing i have done...

I have another system where i used typed datasets... basically used the the
toolbox and dropped adpaters, connections, datasets and used them for my
data sources... In this case these events seem to work fine... Is there a
way to make untyped datasets which we prefer to use... work with these
events?
 
Figured out a way to fix problem... Here is the addhanle and event it fires
if anyone else is having this issue..

Private Sub rowchanging_handle(ByVal start_stop As String)

If start_stop = "start" Then

AddHandler ActivityDS.Tables("activities").ColumnChanging, AddressOf
ColumnChanging

Else

RemoveHandler ActivityDS.Tables("activities").ColumnChanging, AddressOf
ColumnChanging

End If

End Sub



Private Sub ColumnChanging(ByVal sender As Object, ByVal e As
DataColumnChangeEventArgs)

If (Trim$((e.ProposedValue).ToString) <>
Trim$((e.Row.Item(e.Column.ColumnName)).ToString)) And (btnAdd.Enabled) =
True Then

rec_changed = True

Me.BackColor = gModMaintBackColor

btnCancel.Enabled = True

rowchanging_handle("stop")



End If

End Sub
 
Back
Top