Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show special characters in textbox

Status
Not open for further replies.

boein

Technical User
Jul 17, 2003
84
BE
Hi,

I want to display a special character '?' in a textbox to make this sentence in the textbox: "press '?' to continue".
When I take a look at the windows character map almost every font has this character but I cannot use it in vb because the value for chr()-function cannot exceed 255. For example chr(97) corresponds with 'a' (the hex-value is 61, the value that is shown in the windows Character map).
So far no problem. But I want to display the character '?' value 0x25BA (9658) I get an error, chr() cannot exceed with a value of 255 (FF).
Is there another possibilty to achieve this.

thanks
Wim
 
I know this sounds a bit over simplified but why not use:
Code:
Text1.Text = "press '?' to continue"

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
LOL, didn't thought about that one ;-). No that's too easy. When I posted my question I saw that my 'special character' turned into a question mark '?'. In fact the special character looks like the symbol that is used for "play" |> someting like this.

 
If you want to use CHR() then the ASCII code for the questionmark is 63. You can find them at
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
[lol]
Didn't think it would be that easy but sometimes you have to post the obvious [wink]

I take it the character you want to display is the 'Black Right-Pointing Pointer' from the Unicode character set?

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Yep that's the one,

a bit more difficult to display than a question mark I suppose? ;-)

Thanks,
Wim
 
...Looks like a case of ASCII unclear question, get an inappropriate ANSI [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Yeah, I'm not sure that you can diplay it in a Textbox as I think they can only display ANSI characters (I could be corrected on this one though).

You will however, be able to display it in a RichTextBox control (Microsoft Rich Textbox Control 6.0).

If you copy it into the RTB from the character map then it will display fine. You'll have to play around with the .TextRTF to get it right.

Try this for starters:
Code:
RichTextBox1.TextRTF = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\lang2057\f0\fs17 press \f1\fs26\u9658?\f0\fs17 to continue\par }"
Hope this helps! [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
john - [lol]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Does vb6 support a rich-textbox object, I have no experience with this object. How can I add one?
Maybe this is indeed a simple question, but I really dunno :)

 
Harley,
Found the rich-textbox object, and it works with your code. Many thanks for our your help!!!

Regards
Wim
 
VB6 does support the RichTextBox [smile]

You need to add it as a component to your project via Project-->Components and tick the Microsoft Rich Textbox Control 6.0.

It will then appear as a control you can add to your form.

Once you add the control you can then add the code I posted to an event (Form_Load for example) and see if what it produces is similar to what you want.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
You're welcome, glad I could help [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top