Link to home
Start Free TrialLog in
Avatar of BarryTang
BarryTang

asked on

How can I display special characters in VB controls ?

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
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi BarryTang,

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



Hope this helps
Avatar of cryptosid
cryptosid

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...
Avatar of BarryTang

ASKER

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

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...
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 )




Try ChrW() function ?
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

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.  

https://www.experts-exchange.com/questions/20187331/Problem-related-to-Unknown-token-received-from-SQL-Server.html
https://www.experts-exchange.com/questions/20133725/Access-Foxpro-2-6-free-tables-from-SQL-server-2000.html
https://www.experts-exchange.com/questions/20088012/Problem-related-to-insert-a-group-of-record-to-a-data-file.html
https://www.experts-exchange.com/questions/20083509/Connection-Failure-using-local-harddisk.html
https://www.experts-exchange.com/questions/20382035/How-can-I-extract-a-music-track-in-a-midi-file-by-DirectMusic-in-VB.html
https://www.experts-exchange.com/questions/20382294/How-can-I-extract-a-music-track-in-a-midi-file-by-DirectMusic-in-VB.html
https://www.experts-exchange.com/questions/20534626/DLL-Function-can-run-in-exe-but-fail-to-run-in-VB6-environment.html
https://www.experts-exchange.com/questions/20521771/How-can-I-avoid-the-split-of-word.html
https://www.experts-exchange.com/questions/20515842/Can-I-use-this-DLL-in-VB6.html
https://www.experts-exchange.com/questions/20513575/Problem-related-to-shell-wait.html
https://www.experts-exchange.com/questions/20493221/Problem-related-to-the-scroll-value.html
https://www.experts-exchange.com/questions/20436510/How-can-I-made-a-form-on-top-but-will-disappear-when-switch-to-screen-of-other-windows-task.html
https://www.experts-exchange.com/questions/20399960/How-to-use-a-C-dll-in-a-VB6-program.html
https://www.experts-exchange.com/questions/20395868/How-to-play-a-specific-frequency-of-wave-sound-out.html
https://www.experts-exchange.com/questions/20375410/How-can-I-display-special-characters-in-VB-controls.html
https://www.experts-exchange.com/questions/20373966/How-to-display-musical-note-from-midi-file-in-a-VB-program.html
https://www.experts-exchange.com/questions/20372811/How-to-use-DLL-in-my-VB-program.html

Thank you.
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