Click to See Complete Forum and Search --> : Command button Reuse


vector
June 15th, 2000, 10:21 AM
I have a form with a command button named 'Compute'.After the user clicked to compute and the results generated,I set certain properties on my output text box (Locked=True and ForeColor=vbYellow)and my Compute button caption to change to 'Try again'

I would like to use the SAME button to do another computation.I wish to toggle the properties on the text box which I've just changed and the button to read as 'Compute' again.

Do you think this is possible ? Pls enlighten me.

Lots of thanks.

Lothar Haensler
June 15th, 2000, 10:31 AM
This should work

sub compute_click
select case compute.caption
case "Compute"
' do your computation
txt.Locked = true
txt.ForeColor = vbYellow
compute.caption = "Try Again"
case "Try Again"
compute.caption = "Compute"
' do your computation
txt.Locked = false
txt.ForeColor = ???
end select
end sub

d.paulson
June 15th, 2000, 09:08 PM
If you don't mind using two command buttons, you can place both of them in the same position and toggle the visible property.


private sub cmd1_click()
cmd2.visible = true
cmd1.visible = false
end sub

private sub cmd2_click()
cmd1.visible = true
cmd2.visible = false
end sub




David Paulson