How can I display special characters in VB controls ?

BarryTang
BarryTang used Ask the Experts™
on
I would like to display some special characters
( e.g. °(ascii 176), ± (ascii 177)) in a VB form ( or other VB controls ).

How can I do it by program ?

Thank you

Barry
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
Commented:
Try use Chr and Asc function in VB.

cheers

Commented:
Hi BarryTang,

You can use Chr function which returns a string corresponding to character code.



Hope this helps
Yes it can be done find a font that displays all the special characters and then set the label or textbox to that font then user character function chr() and others to display it...
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Hello, everybody :

Thanks for response,
but I still cannot display my result.

I use the following code that try to display
the character : ± ( for font : Arial )
BUT IT CANNOT WORK

    Text1.Font = "Arial"
    Text1.Text = Chr(177)

    Label1.Font = "Arial"
    Label1.Caption = Chr(177)

Please advice

Barry

Commented:
I don't know what you mean it CANNOT WORK.

I just put in your exact code and it seems to work fine.

Yes ventond is correct it works at my place too...
try refreshing the controls after assigning the values...

Author

Commented:
CANNOT WORK mean cannot see anything in the label or textbox

If I input as follows

    Label1.Font = "Arial"
    Label1.Caption = Chr(65) & Chr(67)
    Label1.Refresh

the result on the label is "AC", it is OK

But if I change the caption to

       Label1.Caption = Chr(177)

it cannot see anything

  or   Label1.Caption = Chr(65) & Chr(177) & Chr(67)

it just display "A"

I still don't the reason.
Is the working environment related ?
( I am using VB6(SP3) on Windows 98 Chinese Version )




Ryan ChongSoftware Team Lead

Commented:
Try ChrW() function ?

Author

Commented:
I try the chrw() function and find that it can display
some of the character correctly like chr(177) as ±

However, some displayed character is totally different
from the ascii table
   like chr(169) should be ©
   but VB display just a letter c and missing the circle ??

other examples are chr(129),chr(130),chr(131),....

Can you solve it or give me some explaination for this ?

Thank you

Commented:
You say that you are on the chinese version, what does your character map say value 177 for font Arial looks like?
BarryTang,
You have 17 opened questions as of this date.  
I will be posting in each of these questions.  
Please take care of your opened questions older than 30 days by clicking on your logon name link and looking for UnlockedQ or using the links I am providing below.  
Please finalize these within 72 hours or I will ask administration to look into your account at that point.  If you have questions, please ask and I will provide assistance.  

http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_20187331.html
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_20133725.html
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_20088012.html
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_20083509.html
http://www.experts-exchange.com/Miscellaneous/Games/Q_20382035.html
http://www.experts-exchange.com/Programming/Game_Development/Q_20382294.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20534626.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20521771.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20515842.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20513575.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20493221.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20436510.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20399960.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20395868.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20375410.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20373966.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20372811.html

Thank you.
Author of the Year 2009

Commented:
BarryTang,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept ryancys's comment(s) as an answer.

BarryTang, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial