Page 1 of 1

Get FieldName of changed property

PostPosted: Mon Aug 03, 2015 6:42 pm
by DannyC
Hi,

Back in 6.5.13, on a module in the Changed breakout event, we were passed the FieldName.
In Jiwa 7, how can we get the fieldname when PropertyChanged fires a sub?

For example, if I wanted to write some code when the Debtor, On Hold tickbox has been ticked or unticked, how can I check that it was the AccountOnHold field which was edited?
Code: Select all
    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      Dim DebtorForm As JiwaDebtorsUI.frmDebtor = DirectCast(JiwaForm, JiwaDebtorsUI.frmDebtor)
      AddHandler DebtorForm.Debtor.PropertyChanged, AddressOf Debtor_Changed   
   End Sub
   
   Sub Debtor_Changed(Sender As Object, e As System.EventArgs)
      Dim Debtor As JiwaDebtors.Debtor  = DirectCast(sender, JiwaDebtors.Debtor)   
      msgbox(Debtor.AccountNo)
   End Sub


Thanks

Re: Get FieldName of changed property

PostPosted: Thu Aug 06, 2015 12:33 pm
by indikad
I too need some help here too .

My requirement is in "SalesOrderLineChanged" event

I have a 6.5.13 code that needs conversion ( has some code that has filtering logic by the FieldName ).

Re: Get FieldName of changed property  Topic is solved

PostPosted: Tue Aug 18, 2015 4:27 pm
by Mike.Sheen
The Changed events we have pass a parameter of type System.ComponentModel.PropertyChangedEventArgs.

eg:

Code: Select all
Sub Debtor_PropertyChanged(Sender As Object, e As System.ComponentModel.PropertyChangedEventArgs)


Danny's example is wrong - I don't know how he arrived at his example, but it's not right so ignore it.

So, e in this example has some properties - examine them and you will find one named "PropertyName". This is the name of the property which changed causing the PropertyChanged event from firing.