Lars,
In addition to CJ's comments.
Have you separated your UI from your Domain/Data objects? This should be
easy! In your domain objects as properties change, the Total property would
change. If you don't have Domain (business) objects per se and are binding
directly to Data objects (such as a DataSet/DataTable) you can use the
events on the DataTable itself to update to total fields. Such as
DataTable.ColumnChanged, DataTable.RowChanged and DataTable.RowDeleted.
An alternative:
Remember that an Event can be handled by more then one handler, and that a
single handler can handle events for more then one object.
The "problem" as CJ suggested, is that the signature of the event handler
needs to match the signature of the event. You may need two extra
handlers...
You could have an extra Changed event handler that would update the total
field, for each of the UI controls, they would have their own Changed event
handler, plus this extra Changed handler would handle the changed event.
Private Sub Text1_Changed(...) Handles Text1.Changed
Private Sub Text2_Changed(...) Handles Text2.Changed
Private Sub Text3_Changed(...) Handles Text3.Changed
Private Sub AnyText_Changed(...) Handles Text1.Changed, Text2.Change,
Text3.Changed
' calculate total amount
End Sub
You can use VS.NET to set the first three Changed event handlers, however
you will need to type in the third event handler.
Hope this helps
Jay
"Lars Netzel" <[no_spam_please]la*********@qlogic.se> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
Is there any way to add some code that will happen in every single Event
that i raised in a form?
I have a Total field in the bottom of a pretty complex page and I think
it's kind of "Dirty" to update that Filed from every single Event that might
affect it
Is there are was to keep that Filed Total (a value) updated at all time
without having to think about it in every single event on the page?
Nomatter what happens and what fileds are updated on the page.. in a grid
or in another filed, I want that Total filed to be Updated...
/Lars