Print Special Character in VB6

Posted on 2011-10-24
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
    LVL 44

    Expert Comment

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

    Author Comment

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

    Accepted Solution

    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

    Thank You for the additional information

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now