Re: ASCII Special Characters
You'll have to create a resource file(s) for each language for that purpose.
Re: ASCII Special Characters
Quote:
Originally Posted by RhinoBull
You'll have to create a resource file(s) for each language for that purpose.
I don't think that is what I want. I understand resource files to allow me to change menu items to another language. I want to be able to output a special character to the textbox by clicking a button. Is there a way to do this?
Re: ASCII Special Characters
sure thats fine. do it like this:
button_click()
text1.text = text1.text & chr(155)
end sub
Re: ASCII Special Characters
Quote:
Originally Posted by |2eM!x
sure thats fine. do it like this:
button_click()
text1.text = text1.text & chr(155)
end sub
Excellent. Is there a way to get the character to show up on the button face?
Re: ASCII Special Characters
set the caption of the button to chr(155) if you want it to show up on the button
Re: ASCII Special Characters
Quote:
Originally Posted by kfcSmitty
set the caption of the button to chr(155) if you want it to show up on the button
That just seems to put chr(155) on the button, not the special character.
Re: ASCII Special Characters
You have to use selected font so you can actually assign some particular character from it. Also, regular textbox doesn't support multiple fonts so you might need to switch to RichTextbox.
In any case as I said resource file is the way to go. ;)
Re: ASCII Special Characters
Quote:
Originally Posted by RhinoBull
You have to use selected font so you can actually assign some particular character from it. Also, regular textbox doesn't support multiple fonts so you might need to switch to RichTextbox.
In any case as I said resource file is the way to go. ;)
Two questions:
What is "selected font," and what is a resource file?
Re: ASCII Special Characters
Regarding "selected font" ... that was a waky way of saying it ... :)
What I meant was that you will need to set some font to a command button first and then select that "special" character for its caption.
However, setting that special char as one of the characters in a textbox could be problematic unless button and textbox both have the same fonts.
Using RichTextBox on the other hand will allow you to set any available font to a single character (SelFont is the property I believe) so the proper char will be displayed. Also, since fonts are usually tricky to work with you might need to (but not necessary) distribute font(s) utilized in your project.
Here is a quote from MSDN that explains resource files in a nutshell:
Quote:
Working with Resource Files
A resource file allows you to collect all of the version-specific text and bitmaps for an application in one place. This can include icons, screen text, and other material that may change between localized versions or between revisions or specific configurations.
Adding Resources to a Project
You can create a resource file using the Resource Editor add-in. The compiled resource file will have a .res file name extension. Each project can contain only one resource file.
The actual file consists of a series of individual strings, bitmaps, or other items, each of which has a unique identifier. The identifier is either a Long or a String, depending on the type of data represented by the resource. Strings, for example, have a Long identifier, while bitmaps have a Long or String identifier. To retrieve resources in your code, learn the identifier for each resource. The function parameters referring to the resources can use the Variant data type.
To add a new resource file to your project
Choose Resource Editor from the Tools menu. An empty resource file will be opened in the Resource Editor window.
Note The Resource Editor add-in must be installed. For information on installing add-ins, see "Using Wizards and Add-Ins" in "Managing Projects".
Select the Save button on the Resource Editor toolbar to save the resource file. The file will be added to the Project Explorer under the Related Documents section.
To add an existing resource file to your project
Choose Add New Resource File from the Project menu. Any existing resource file in your project will be replaced.
Caution If you make any modifications to an existing resource file it could affect other projects that use that resource file. Make sure that you save the file under a new filename.
Note The Resource Editor add-in must be installed. For information on installing add-ins, see "Using Wizards and Add-Ins" in "Managing Projects."
For More Information For more information on resource files, see "Using Resource Files for Localization" in "International Issues."
Note Windows resource files are specific to 16-bit or 32-bit applications. Visual Basic will generate an error message if you try to add a 16-bit resource file to a project.
Using Resources in Code
Visual Basic provides three functions for retrieving data from the resource file for use in code.
Function Description
LoadResString Returns a text string.
LoadResPicture Returns a Picture object, such as a bitmap, icon, or cursor.
LoadResData Returns a Byte array. This is used for .wav files, for example.
For More Information See the appropriate function topic.
Re: ASCII Special Characters
Quote:
Originally Posted by dmyhand
That just seems to put chr(155) on the button, not the special character.
I'm thinking maybe you put "chr(155)" instead of just chr(155)
Re: ASCII Special Characters
Quote:
Originally Posted by half flung pie
I'm thinking maybe you put "chr(155)" instead of just chr(155)
Nope. Tried that already. Is there a way to make an image show up on a button face?
Re: ASCII Special Characters
just type (this example is for the form load event)
VB Code:
Private Sub Form_Load()
button1.caption = chr(155)
end Sub
Re: ASCII Special Characters
Quote:
Originally Posted by kfcSmitty
just type (this example is for the form load event)
VB Code:
Private Sub Form_Load()
button1.caption = chr(155)
end Sub
That is it! You guys are great. Thanks, again.
Re: ASCII Special Characters
except it will never show the character..
Re: ASCII Special Characters
Quote:
Originally Posted by |2eM!x
except it will never show the character..
I am using graphics of each special character on the button faces. This seems to be the easiest way to show the characters so my wife can type them by clicking once on the button instead of alt+192 or whatever. It is coming along nicely. Thanks, dennis
Re: ASCII Special Characters
this is a great idea, i might look at doing a small program, using this to paste into other programs, to save having to search through all the fonts character map each time
pete
Re: ASCII Special Characters
Quote:
Originally Posted by |2eM!x
sure thats fine. do it like this:
button_click()
text1.text = text1.text & chr(155)
end sub
I would not use that code since it's very slow, besides it only allows you to add the character at the end of the text while it will move the text cursor to the beginning. Use the SelText property instead.
VB Code:
Text1.SelText = Chr$(155) 'or whatever ASCII value you want to use