Author: KAM.covad
Posted: 2009-03-26 at 17:31:18
I agree with this. We have something similar. The name of the button =
should be the value you want to store. The caption should be something =
similar. In cmdbutton.click() put thisform.StoreThisValue(This.Name)
Now you can simply copy this button and change the name and caption of =
the other buttons. No need to change click()
Depending on your values, you could make that the caption and pass =
this.caption so you do not need to modify the button names
----- Original Message -----=20
From: Vince Teachout=20
To: ProFox Email List=20
Sent: Thursday, March 26, 2009 10:25 AM
Subject: Re: Update field value
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.
>=20
> There will be multiple buttons each with its own distinct value.
>=20
> 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.
>=20
> Is there a way to have the method determine which button was clicked, =
and
> therefore assign the new value to the field.
>=20
> The code I'm using now in the button.click is:
>=20
> SELECT bidboard
>=20
> UPDATE bidboard SET amount =3D 6000
>=20
> llok =3D tableupdate(1,.f.,'bidboard')
>=20
> thisform.refresh
If I'm following you correctly, I would create a form method MyMethod=20
with a parameter. In the button click, I'd either call=20
Thisform.MyMethod(1) (Where the numeric is different for each button),=20
or better yet ThisForm.MyMethod(this.name) (allowing for exactly the=20
same code in each button)
Then in the method, use a CASE statement, and proceed from there.
[excessive quoting removed by server]