when I enter this into the caption property of a command button: Query\T & P System

it displays this: Query\T_P System

is there any way to fix this??

Dani AI

Generated

This is the normal Windows behavior: an ampersand before a letter marks a mnemonic (access key) rather than a printable character, so the control renders that letter as the shortcut instead of showing a literal ampersand. is correct — escape the ampersand by doubling it so the button shows a real "&" instead of creating an access key. Microsoft documents this behavior for controls and hot keys (see the guidance on adding a hot key to a control).

Use the Properties window at design time for static captions (quick, visible, and what the designer expects). Use code (for example, setting the caption on form load) when the text is dynamic, localized, or when you need to troubleshoot what gets assigned at runtime — this is the point was making. The control Name is mainly a design-time identifier used in source; changing identifiers at runtime is uncommon and often unnecessary — update Caption/Text, Tag, or manage controls through a collection if you need runtime-driven behavior.

If the doubled-ampersand approach does not seem to work, confirm you are editing the control's Caption/Text property (not Name), and verify the control supports mnemonics. Note also that modern Windows may hide underlines until Alt is pressed; that affects only how mnemonics are shown, not whether an ampersand is treated as a mnemonic character. For official details, see .

Recommended Answers

All 6 Replies

You need to use Query\T && P System

in the caption property.

ok and thanks!!!

my suggestion is putting it on the form load event

so you do not use the direct properties for controls? you always put it in the code?

yeh, you can easily see where the prob, if there is , and u wont need to click n click n click on the properties section,

Then what is the use of property pallet.
Can you do the same for name property from code window.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.