Author: MB Software Solutions General Account
Posted: 2009-03-26 at 14:55:28
Vince Teachout wrote:
> Jim Harvey wrote:
>> I'd like to update a field value by allowing the user to click a button
that
>> has a value as it's caption.
>>
>> There will be multiple buttons each with its own distinct value.
>>
>> I can put code in the click of each button knowing it's assigned value,
and
>> that will do the job, but would rather use a form method.
>>
>> Is there a way to have the method determine which button was clicked, and
>> therefore assign the new value to the field.
>>
>> The code I'm using now in the button.click is:
>>
>> SELECT bidboard
>>
>> UPDATE bidboard SET amount = 6000
>>
>> llok = tableupdate(1,.f.,'bidboard')
>>
>> thisform.refresh
>
>
> If I'm following you correctly, I would create a form method MyMethod
> with a parameter. In the button click, I'd either call
> Thisform.MyMethod(1) (Where the numeric is different for each button),
> or better yet ThisForm.MyMethod(this.name) (allowing for exactly the
> same code in each button)
Vince -- you meant ThisForm.MyMethod(this) (...not just the name
attribute, but the actual object) right?