The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
6.2 Equivalent of GetProperty("Name")
Posted: 05 Jun 06 12:22 PM
|
fiogf49gjkf0d Switching over from 5.2 dev environment to 6.2 and wondering what the equivalent of the v5.2 GetProperty("Name") function is in v6.2? I need to know the name of the control that is calling the vbScript so that I can use a common sub instead of duplicating code.
Thanks. |
|
|
|
Re: 6.2 Equivalent of GetProperty("Name")
Posted: 05 Jun 06 1:24 PM
|
fiogf49gjkf0d In 6.2, the events will have a sender parameter passed in. This is a reference to the control that triggered the event. So if you use the same "OnClick" handler for multiple buttons, you could use sender.Name to get the name of the control that actually fired the event. |
|
|
|
Re: 6.2 Equivalent of GetProperty("Name")
Posted: 05 Jun 06 1:45 PM
|
naltrexone buy uk buy naltrexone online canada click here citalopram and alcohol reddit alcohol and antidepressants citalopram go fiogf49gjkf0d I had to pass the original sender parameter through to the subroutine, but that worked great!
Thanks!
Sub txtDiscountExitControl(Sender) CalcDiscount(Sender) End Sub
Sub txtFinalPriceExitControl(Sender) CalcDiscount(Sender) End Sub
Sub CalcDiscount(Sender) If Sender.Name = "txtDiscount" Then ' Calculate Final Price txtFinalPrice.Text = vTotalPrice * (1 - vDiscount) Else ' Calculate Discount txtDiscount.Text = 1 - (vFinalPrice / vTotalPrice) End If End Sub
|
|
|
|
Re: 6.2 Equivalent of GetProperty("Name")
Posted: 05 Jun 06 2:10 PM
|
fiogf49gjkf0d You know, you can also create a generic handler sub (which takes a single parameter for sender) and then wire up all the controls to use it. This way you don't have to have a handler to just pass off to some other handler (like you show in your code)
In the property list, click over to the events, then use the drop down to just select the "CalcDiscount" sub for the txtDiscountr and txtFinalPrice controls. Then you don't need that extra step. |
|
|
|
Re: 6.2 Equivalent of GetProperty("Name")
Posted: 05 Jun 06 2:14 PM
|
fiogf49gjkf0d You're right! I had originally coded it with the CalcDiscount sub not having a sender and thought I had to pass through!
Thanks! |
|
|
|