Trouble with Ampersand Character
Posted: Sat Dec 15, 2012 5:54 pm
Does any one know if the Ampersand character (&) needs to be escaped when used in some circumstances?
For example with the code below, the form caption displays the & character correctly, yet the button caption does not. Seems that the & and a space is replaced with an underscore.

The answer is probably simple but I cannot for the life of me figure out how to get the ampersand to display properly on the button...can anyone provide some guidance?
Thanks.
For example with the code below, the form caption displays the & character correctly, yet the button caption does not. Seems that the & and a space is replaced with an underscore.

The answer is probably simple but I cannot for the life of me figure out how to get the ampersand to display properly on the button...can anyone provide some guidance?
Thanks.
Code: Select all
Option Explicit
Dim Form, Btn
Sub OnStartup
Script.RegisterEvent SDB, "OnPlay", "OnPlaybackStart"
End Sub
Sub OnPlaybackStart
Set Form = SDB.UI.NewForm
Form.Common.SetRect 100, 100, 500, 400
Form.Caption = "Title with an & ampersand"
Set Btn = SDB.UI.NewButton(Form)
Btn.Caption = "Close & exit"
Btn.Common.SetRect 10, 10, 100, 20
Form.ShowModal
End Sub