Forgive me if this is a silly question, I am extremley fresh writing in cal code, but is it possible to dynamically change a command buttons caption property value?.
I’m not aware of any straight-forward method for doing this. See if you like the following work-around: 1. Create a command button 2. Set its BackTransparent property to Yes 3. Set its ShowCaption property to No 4. Create a text box 5. Set its Width property to 2200 6. Set its Height property to 550 7. Set its Focusable property to No 8. Set its BackTransparent property to Yes 9. Set its Border property to No 10. Set its SourceExpr to the value you want to use as the button caption 11. Place the command button on top of the text box. Note that: a. On a normal command button, the caption moves slightly when the button is pressed. I suppose that, with a bit of code, you could get the same effect (challenge!) b. I don’t think you can use accelerator keys (Alt+…) when using this approach, which is why I never use it myself.
Thanks for your help, it is an effective work around.
Hi Andrew, Two other possibilities that may work for you are: 1) Have two buttons both with the same code attached but that have different lables and set the visibility property dynamically. 2) Use a button without a caption and dump a text box over the top. Use a function as the source of the text box and your away. You may you need to check which item, the button or the text box is in the foreground. I have used method number 1 to control menu buttons quite successfully and you don’t have the problem with the accelerator keys. HTH Simon