views:

658

answers:

5

For displaying the character & in a button as text, i am using &&

I would like to display the string % in another one button but the &% does not work.

So how can i display the char %

By using this btn5.Text = "%" the percentage symbol is not displayed at all!

A: 

Just having % on its own works, there is no need to escape it

Iain Hoult
+1  A: 

Perhaps a devexpress button does something non-standard with its button captions? A standard button should have no problem displaying a % character.

Christian Hayter
I wish i knew! I just sent a support ticket to devx..
Chocol8
Have you tried looking at the devx button control source code with Reflector?
Christian Hayter
A: 

If &% doesn't work, try using %% instead. I know DevExpress was first developed in Delphi and in Delphi, the % character is an escape character too!

And a follow-up, based on this link I found you might have to use \% instead of &%, %% or just %...

If that doesn't work, you can either contact the Support department of DevExpress or check the source code, if you have those available.

Problem is, no one ever considered defining one single escape character.

Workshop Alex
I already did... no luck!
Chocol8
A: 

I can not confirm your problem. Adding a button (type System.Windows.Forms.Buton) to a form with .Text equal to "%" worked for me both at design and at run time.

Peter Mortensen
A: 

Btn5.Text = Chr(37)

Rob
This differs from btn5.Text = "%" because?...
Workshop Alex
the question says "By using this btn5.Text = "%" the percentage symbol is not displayed at all!"I tested Btn5.Text = Chr(37) and it is displayed just fine.
Rob