views:

684

answers:

2

Hey, I'm trying to figure out how to display the ▼ character properly in a .NET winform application.

I am creating a custom control, and for the button, I want this character to appear. I am able to set the text to this character, but it appears as a blank square.

Any ideas on what I need to do to make this character appear properly on my forms?

I am using Arial font, which is compatible with this symbol.

EDIT: It is currently being set as follows:

btnCalendarToggle.Text = "▼"  'Yes, it appears exactly like this in my code

More information on the character can be found here: http://www.fileformat.info/info/unicode/char/25bc/index.htm

EDIT2: I tried adding some other Unicode characters, and got the following message:

"Some Unicode Characters in this file cannot be saved in the current codepage. Do you want to resave this file as Unicode in order to Maintain your data?"

After clicking YES on this message, it still didn't work. It appears that the encoding method may be wrong for the file... I don't know what to set it to. Has anyone else tried to display this character in a winform before?

A: 

Can you post the code you are currently using ?

You can print out characters using the chr(int) function if you know the character code.

Dim i As Integer
For i = 0 To 255
    txtTest.Text = txtTest.Text & Chr(i) & " -- " & i.ToString() & Environment.NewLine
Next i

Try that and see if your character prints out.

Kaius
+9  A: 

There can often be issues (both with source control systes and diff tools) if you embed more complex unicode characters in source files.

It is often better to do it via an explicit escape sequence and keep the source file in a simpler encoding.

btnCalendarToggle.Text = "\u25BC";

If this works it is likely that the problem is instead the encoding settings for the source file.

Are you certain however that the font in question is Arial (try debugging and checking) since regardless of the above mentioned issues so long as the encoding is set to a legitimate Unicode one (and Visual Studio will convert the file for you if you embed such a character in it) this should have worked.

ShuggyCoUk