By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,246 Members | 1,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,246 IT Pros & Developers. It's quick & easy.

Reproducing "&"

P: n/a
Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to reproduce
reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel
Aug 1 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Michel Vanderbeke wrote:
Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
Do you mean when it appears in a menu? The ampersand is used in menus to
indicate that the next character is the keyboard shortcut for that menu
item.

Could you use the word "and" instead?

Andrew
Aug 1 '08 #2

P: n/a
Michel,

Probably you are from the BeNeLux and then from Flemish Belgium like your
name is Vanderbeke and you use as a kind of anonymous name Flupke. Can you
first tell us why the & gives an underscore on the screen. We would probably
use the same settings but I have never noticed that.

Cor

"Michel Vanderbeke" <Fl****@newsgroup.nospamschreef in bericht
news:uC**************@TK2MSFTNGP05.phx.gbl...
Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel
Aug 1 '08 #3

P: n/a
Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?
You have to handle it manually. Access keys are automatically recognized by
the system when you're dealing with windows (in menus, dialog controls,
etc.) but for custom purposes you're on your own.
Aug 1 '08 #4

P: n/a
On Aug 1, 10:39*am, "Larry Smith" <no_spam@_nospam.comwrote:
Can you please help me?
To produce a "&"-sign on the screen, I use "&&". *Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".
So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?

You have to handle it manually. Access keys are automatically recognized by
the system when you're dealing with windows (in menus, dialog controls,
etc.) but for custom purposes you're on your own.
Set the UseMnemonic property to False.
Aug 1 '08 #5

P: n/a
Set the UseMnemonic property to False.

He didn't say he was using .NET but even if he is, that property only
applies to buttons and labels (not menu items for instance). How would it
help anyway.
Aug 1 '08 #6

P: n/a
On Aug 1, 12:14*pm, "Larry Smith" <no_spam@_nospam.comwrote:
Set the UseMnemonic property to False.

He didn't say he was using .NET but even if he is, that property only
applies to buttons and labels (not menu items for instance). How would it
help anyway.
Well, yes, you are correct, although I might mention that it was
crossposted to the dotnet languages vb forum (from which I am
reading). On a button, UseMnemonic disables the automatic "hot-key"
that windows does and will present the & symbol without modification.
I had not realized the menu items would not have the same property, I
suppose I don't use them often enough.
Aug 1 '08 #7

P: n/a
"On the screen" is not enough ? We don't now if this is a Windows or Web
application and how it is displayed. Is this in a control menu, a label, a
textbox ? It all could cause distinct behaviors...

--
Patrice

"Michel Vanderbeke" <Fl****@newsgroup.nospama écrit dans le message de
groupe de discussion : uC**************@TK2MSFTNGP05.phx.gbl...
Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel
Aug 1 '08 #8

P: n/a
On Aug 1, 12:14 pm, "Larry Smith" <no_spam@_nospam.comwrote:
Set the UseMnemonic property to False.

He didn't say he was using .NET but even if he is, that property only
applies to buttons and labels (not menu items for instance). How would it
help anyway.
Well, yes, you are correct, although I might mention that it was
crossposted to the dotnet languages vb forum (from which I am
reading).
I missed that.
On a button, UseMnemonic disables the automatic "hot-key"
that windows does and will present the & symbol without modification.
I had not realized the menu items would not have the same property, I
suppose I don't use them often enough.
It really depends on his needs. If he requires an access key in the same
string then he might wind up with this in his DB for example:

"Process && &Exit"

That beccomes "Process & Exit" when the user see it (with the ''E'
underlined). If he now dumps it to a report however then its his
responsibility to peform this magic himself. Of course he can always store
it as ""Process & Exit" instead and track the access key another way
(storing the offset of 'E' in a separate field for instance - when
displaying it on screen, he would then replace all single occurences of "&"
with "&&" and insert the access key "&" at the given offset - if he's
localizing it though then he'd have to store the offset for each language).
Aug 1 '08 #9

P: n/a
Michel Vanderbeke wrote:
Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to reproduce
reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single "&"
where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel
Strings often need different escaping depending on where it's used, for
example url encoding and html encoding.

In your case you need to escape the & character when you put the string
in a control by replacing it with &&.

You should store the text in the original form in the database, i.e.
with the single & characters, and do the replacement when you put the
text in the controls:

someControl.Text = textFromDatabase.Replace("&", "&&")

--
Göran Andersson
_____
http://www.guffa.com
Aug 1 '08 #10

P: n/a
Hello,

That is exactly what I was looking for!
Many thanks!

Michel

"Göran Andersson" <gu***@guffa.comschreef in bericht
news:eQ**************@TK2MSFTNGP06.phx.gbl...
Michel Vanderbeke wrote:
>Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a single
"&" where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel

Strings often need different escaping depending on where it's used, for
example url encoding and html encoding.

In your case you need to escape the & character when you put the string in
a control by replacing it with &&.

You should store the text in the original form in the database, i.e. with
the single & characters, and do the replacement when you put the text in
the controls:

someControl.Text = textFromDatabase.Replace("&", "&&")

--
Göran Andersson
_____
http://www.guffa.com

Aug 2 '08 #11

P: n/a
Göran Andersson <gu***@guffa.comwrote in
news:eQ**************@TK2MSFTNGP06.phx.gbl:
Michel Vanderbeke wrote:
>Hello,

Can you please help me?
To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
underscore on the screen.
However, when a text is in a database, and I use the same field to
reproduce reports, the name in the report is written also with "&&".

So I want to have it both ways: on screen as well as on paper a
single "&" where a single "&" must be.
How can I achieve this?

Many thanks for your help,

Michel

Strings often need different escaping depending on where it's used,
for example url encoding and html encoding.

In your case you need to escape the & character when you put the
string in a control by replacing it with &&.

You should store the text in the original form in the database, i.e.
with the single & characters, and do the replacement when you put the
text in the controls:

someControl.Text = textFromDatabase.Replace("&", "&&")
And depending on where this is being drawn, in Win32 there's the NOPREFIX
flag. THis applies to static text controls (SS_NOPREFIX) or DrawText
(DT_NOPREFIX).

Dave Connet
Aug 2 '08 #12

P: n/a
"David Connet" <st***@agilityrecordbook.comschrieb:
And depending on where this is being drawn, in Win32 there's the NOPREFIX
flag. THis applies to static text controls (SS_NOPREFIX) or DrawText
(DT_NOPREFIX).
This option is even available in .NET's 'TextRenderer.DrawText' if
'TextFormaFlags.NoPrefix' is specified.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 2 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.