Print Special Character in VB6

Posted on 2011-10-24
Medium Priority
Last Modified: 2012-05-12
I am using chr$(42) right now for printing a special character.  
How can i make it the smile-face character instead?
This needs to be added to a text string.
Example sub * with smiley-faces
Question by:GarySB
  • 2
LVL 50

Expert Comment

by:Martin Liss
ID: 37021502
Is the smiley actually in the text?

Author Comment

ID: 37021518
I want to print a sentence and substitute the smiley face for some letters.
LVL 11

Accepted Solution

kbirecki earned 1000 total points
ID: 37021657
You have two choices, neither one is trivial.  

You could use a rich text box that would allow you to combine fonts.  And you could do some replacement of the special character(s) that you want to represent your smiley, basically like what you might see on a website that supports what you describe.  Check this site.  Your smiley could be the "picture" inserted by this example code.  (Or search for "vb6 rich text box smiley".)

If you want it embedded in text, you have to find a character set that includes the character you want to substitute, because that is the "only" font you can use in the text box.  Text boxes can only have one font assigned to them, so the character you want has to be in the assigned font.

To find a font you can use, if you choose start - run and type (or Start - and then type in Win 7),  "charmap", you'll get the Character Map Windows program that you allows you to sift through the list of fonts you have on your computer.  Important Note: your concept depends on the fonts that are currently installed on any computer that you expect to be able to use your app.  I've done this, and I found in some cases, you have to find a Unicode font set to get decent special characters *and* regular alphabetic/numeric characters and it has to be installed on your target system.  And just because you have the font, does not necessarily mean you can redistribute, so check into that as well.  Some fonts are licensed.  You may have to use Unicode functions when you do any replacements or reference to the characters, such as ChrW(10003) for character with ASCII value of 10003.  It's a little tricky, but it can be done.  But again, it relies on the font selected being installed on the target computer(s).  

Author Closing Comment

ID: 37021665
Thank You for the additional information

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question