Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

label.caption problem 2

Status
Not open for further replies.

gadgetguy1111

IS-IT--Management
Mar 19, 2002
20
0
0
SG
hello,

i'm using labels to display data retrieved from a recordset.
i chose to use labels instead of textboxes (i am aware that textboxes can be locked to prevent editing) so that my user will know that the information cannot be changed.

the problem is that some of the data to be displayed contains the & sign. so it shows up as an underscore instead of the & sign.

any ideas how i can solve this problem?

thanks.
 
The reason that's happening is that the '&' is the shortcut key, meaning that the next character is to be displayed with an underscore as a 'Hot Key'

To force the '&' to show in the lable = use two of them
Label.Caption = "Label && Caption"

Since you're coming from a recordset, I would suggest something like the following:

Label.Caption = ResetText(RecSet.Fields("FldName"))

Private Function ResetText (InString as String) As String

ResetTest = Replace(InString, "&", "&&")

End Function Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
hey,

need not do this just set the UseMnemonic Property of the label control to false.

regards
Niraj [noevil]
 
hello

try to use double '&&' instead of one '&'
it'll solve ur problem

COmputerJin
 
Why turn off a feature that you don't have to. You can do both.

If you set the UseMneumonic property to false, then the & char will appear in the label caption, but you have lost the shortcut key facility.

If you leave the UseMenumonic property to true, and as my first post suggested, use "&&" then you can still put the & in the caption, and still be able to use the Shortcut key.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top