Home All Groups Group Topic Archive Search About
Author
8 Jul 2009 3:12 AM
Rich Raffenetti
If you paste the following four statements into the form_load sub of a
new VB6 Standard EXE and add a label, a text box, and a command button, you
will find on running the program that sometimes (captions in labels and on
command buttons) the string "&&" will appear as one ampersand and sometimes
as two.
    This was a surprise to me and it made me wonder what the logic is behind
the behavior.  Does anyone know why this happens and why it happens only
sometimes??  I could understand ampersand being an escape character but the
inconsistency throws me!

    Label1.Caption = "x&&abc"
    Text1.Text = "x&&def"
    Command1.Caption = "x&&him"
    Form1.Caption = "x&&klm"

--
Rich Raffenetti

Author
8 Jul 2009 4:22 AM
Bob Riemersma
Show quote Hide quote
"Rich Raffenetti" <rich@raffenetti_takethisout.com> wrote in message
news:Oe2a%23n3$JHA.3784@TK2MSFTNGP05.phx.gbl...
>   If you paste the following four statements into the form_load sub of a
> new VB6 Standard EXE and add a label, a text box, and a command button,
> you will find on running the program that sometimes (captions in labels
> and on command buttons) the string "&&" will appear as one ampersand and
> sometimes as two.
>    This was a surprise to me and it made me wonder what the logic is
> behind the behavior.  Does anyone know why this happens and why it happens
> only sometimes??  I could understand ampersand being an escape character
> but the inconsistency throws me!
>
>    Label1.Caption = "x&&abc"
>    Text1.Text = "x&&def"
>    Command1.Caption = "x&&him"
>    Form1.Caption = "x&&klm"
>
> --
> Rich Raffenetti

Ampersand is the escape character used to signal access key characters in
Caption properties.  To self-escape it to include an ampersand symbol in
such properties you double it as &&.

This is just as described in the VB6 docs.  Look in the Language Reference
under Caption Property.
Are all your drivers up to date? click for free checkup

Author
8 Jul 2009 7:37 AM
Bill McCarthy
Hi Rich,

It should appear as && in the textbox, but on command buttons and labels and
especially menus, a single & goes before the letter to underline. (on most
new default window setups, the user has to press ALT before the mnemonics
display)

Show quoteHide quote
"Rich Raffenetti" <rich@raffenetti_takethisout.com> wrote in message
news:Oe2a%23n3$JHA.3784@TK2MSFTNGP05.phx.gbl...
>   If you paste the following four statements into the form_load sub of a
> new VB6 Standard EXE and add a label, a text box, and a command button,
> you will find on running the program that sometimes (captions in labels
> and on command buttons) the string "&&" will appear as one ampersand and
> sometimes as two.
>    This was a surprise to me and it made me wonder what the logic is
> behind the behavior.  Does anyone know why this happens and why it happens
> only sometimes??  I could understand ampersand being an escape character
> but the inconsistency throws me!
>
>    Label1.Caption = "x&&abc"
>    Text1.Text = "x&&def"
>    Command1.Caption = "x&&him"
>    Form1.Caption = "x&&klm"
>
> --
> Rich Raffenetti
Author
8 Jul 2009 9:49 AM
Jan Hyde
"Bill McCarthy" <TPASoft.com Are Identity Thieves>'s wild
thoughts were released on Wed, 8 Jul 2009 17:37:24 +1000
bearing the following fruit:

>
>Hi Rich,
>
>It should appear as && in the textbox, but on command buttons and labels and
>especially menus, a single & goes before the letter to underline. (on most
>new default window setups, the user has to press ALT before the mnemonics
>display)

In addition, if UseMnumonic (spelling!) is set to false then
the label too would show '&&'

J

Show quoteHide quote
>"Rich Raffenetti" <rich@raffenetti_takethisout.com> wrote in message
>news:Oe2a%23n3$JHA.3784@TK2MSFTNGP05.phx.gbl...
>>   If you paste the following four statements into the form_load sub of a
>> new VB6 Standard EXE and add a label, a text box, and a command button,
>> you will find on running the program that sometimes (captions in labels
>> and on command buttons) the string "&&" will appear as one ampersand and
>> sometimes as two.
>>    This was a surprise to me and it made me wonder what the logic is
>> behind the behavior.  Does anyone know why this happens and why it happens
>> only sometimes??  I could understand ampersand being an escape character
>> but the inconsistency throws me!
>>
>>    Label1.Caption = "x&&abc"
>>    Text1.Text = "x&&def"
>>    Command1.Caption = "x&&him"
>>    Form1.Caption = "x&&klm"
>>
>> --
>> Rich Raffenetti

--
Jan Hyde
Author
8 Jul 2009 1:12 PM
Jeff Johnson
"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
news:7rq8555lfj9bcl7klkjcqq2b20cb3dtia4@4ax.com...

> In addition, if UseMnumonic (spelling!)

Mnemonic.

Many people seem to think this word is pronounced like "pneumonia." It is
not. It's more like "anemone." Remember that and you'll never think there's
supposed to be a "u" in it!
Author
8 Jul 2009 2:14 PM
MikeD
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:%23O1Lx28$JHA.1488@TK2MSFTNGP03.phx.gbl...
> "Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
> news:7rq8555lfj9bcl7klkjcqq2b20cb3dtia4@4ax.com...
>
>> In addition, if UseMnumonic (spelling!)
>
> Mnemonic.
>
> Many people seem to think this word is pronounced like "pneumonia." It is
> not. It's more like "anemone." Remember that and you'll never think
> there's supposed to be a "u" in it!
>

According to Merriam-Webster...

Main Entry:1mne·mon·ic
Pronunciation:\ni-'mä-nik\
Function:adjective
Etymology:Greek mnemonikos, from mnemon mindful, from mimneskesthai to
remember - more at mind
Date:1753
1: assisting or intended to assist memory ; also : of or relating to
mnemonics
2: of or relating to memory

--
Mike
Author
8 Jul 2009 3:06 PM
Jan Hyde
"Jeff Johnson" <i.get@enough.spam>'s wild thoughts were
released on Wed, 8 Jul 2009 09:12:04 -0400 bearing the
following fruit:

>
>"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
>news:7rq8555lfj9bcl7klkjcqq2b20cb3dtia4@4ax.com...
>
>> In addition, if UseMnumonic (spelling!)
>
>Mnemonic.
>
>Many people seem to think this word is pronounced like "pneumonia." It is
>not. It's more like "anemone." Remember that and you'll never think there's
>supposed to be a "u" in it!
>
Even if I did remember that I doubt it would help with my
terrible spelling ;-P




--
Jan Hyde
Author
9 Jul 2009 2:07 AM
Rich Raffenetti
Thanks all for the wisdom about &&.  I just don't have the right reference
material.  I appreciate finding out about useMnemonic.
Rich


Show quoteHide quote
"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
news:7rq8555lfj9bcl7klkjcqq2b20cb3dtia4@4ax.com...
> "Bill McCarthy" <TPASoft.com Are Identity Thieves>'s wild
> thoughts were released on Wed, 8 Jul 2009 17:37:24 +1000
> bearing the following fruit:
>
>>
>>Hi Rich,
>>
>>It should appear as && in the textbox, but on command buttons and labels
>>and
>>especially menus, a single & goes before the letter to underline. (on most
>>new default window setups, the user has to press ALT before the mnemonics
>>display)
>
> In addition, if UseMnumonic (spelling!) is set to false then
> the label too would show '&&'
>
> J
>
>>"Rich Raffenetti" <rich@raffenetti_takethisout.com> wrote in message
>>news:Oe2a%23n3$JHA.3784@TK2MSFTNGP05.phx.gbl...
>>>   If you paste the following four statements into the form_load sub of a
>>> new VB6 Standard EXE and add a label, a text box, and a command button,
>>> you will find on running the program that sometimes (captions in labels
>>> and on command buttons) the string "&&" will appear as one ampersand and
>>> sometimes as two.
>>>    This was a surprise to me and it made me wonder what the logic is
>>> behind the behavior.  Does anyone know why this happens and why it
>>> happens
>>> only sometimes??  I could understand ampersand being an escape character
>>> but the inconsistency throws me!
>>>
>>>    Label1.Caption = "x&&abc"
>>>    Text1.Text = "x&&def"
>>>    Command1.Caption = "x&&him"
>>>    Form1.Caption = "x&&klm"
>>>
>>> --
>>> Rich Raffenetti
>
> --
> Jan Hyde


--
Rich Raffenetti
Author
9 Jul 2009 12:07 PM
Larry Serflaten
"Rich Raffenetti" <rich@raffenetti_takethisout.com> wrote
> Thanks all for the wisdom about &&.  I just don't have the right reference
> material.  I appreciate finding out about useMnemonic.

The documentation is free:
http://msdn.microsoft.com/en-us/library/dd430246.aspx

Specifically:
http://msdn.microsoft.com/en-us/library/aa445754(VS.60).aspx

LFS

Bookmark and Share