I have added the following code yet my Calculating Code is not being called WHY ? I need the calculation to occur when the amount in the child is changed, as well as when items are added or deleted. Plus I need to move this to the Pay parent as well because it need properties from it. Specific code required for the parent object. HELP :) Thanks
Protected Overrides Sub OnListChanged(ByVal e As System.ComponentModel.ListChangedEventArgs)
If e.ListChangedType = ComponentModel.ListChangedType.ItemAdded Then
AddHandler Item(e.NewIndex).PropertyChanged, AddressOf OnPayChanged ElseIf e.ListChangedType = ComponentModel.ListChangedType.ItemChanged Then AddHandler Item(e.NewIndex).PropertyChanged, AddressOf OnPayChanged ElseIf e.ListChangedType = ComponentModel.ListChangedType.ItemDeleted ThenOnPayChanged(
Me, New System.ComponentModel.PropertyChangedEventArgs("PayDetails-ListChanged")) End If MyBase.OnListChanged(e) End Sub Protected Sub OnPayChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs)Calculating code
End Sub
Not sure if this is correct please advise
I added a new thread because the old one was getting long and I needed help, if you think its bashing that was not the intent.
If you can offer actual suggestions I would greatly appreciate it. I am simply following previous suggestions. This is not an area I have had experience with, so please be patient.
Keep it simple. Just loop through the line-items and calculate the total. The time spent calculating the total is insignificant in most situations.
I would also suggest reading up on events. There are many websites that are very
helpful. You wouldn’t learn as much if
someone gave you the exact code you need.
Most people in this forum are very helpful and are willing to point you
in the right direction but you need to take some responsibility and take it
from there.
BTW, Bayu was trying to help you. It
is
somewhat disrespectful to suggest that
his response wasn’t an actual suggestion. You shouldn’t open
another thread with the same
question because it casues confusion. You are also less likely to
get the help you need if you create two threads with the same question.
Thanks Guys, the reason I need exact code was I had done research and was unable to find samples from which to learn. I had done quite a few google searchs using the keywords of the suggestions but unable to find anything. And if I was disrespectful it was unintentional. I had been getting a little frustrated with this problem over the last week and may have taken it out on you guys, so apologies. This forum is great because of the help. My lack of understanding came out the wrong way.
A person can tell to use the flint to start a fire, but sometimes you need to see how its used. That was my situation.
All the references I had found had said to used the listchanged etc, but not the how.
So thanks guys for the help
THANKS HEAPS EVERYONE
Through your hard work and extreme patience, my code is working exactly how i need it to, and my understanding has increase a hundredfold.
Copyright (c) Marimer LLC