English characters are stored on the computer in a standardized set of codes known as the American Standard Code for Information Interchange (ASCII). This code contains 256 characters (some of them meant only for the machine to understand) to represent all the common letters, numbers and symbols of English punctuation. It has since been surpassed by Unicode Transformation Format (UTF), though all the original ASCII values maintain the same meaning in UTF to ensure compatibility with older systems. Visual Basic makes it easy to determine the ASCII code value for any character using the "Microsoft.VisualBasic.Asc" function.
Create a new project. Choose the "ConsoleApplication" type. Later, you can use the same code, without modification, within any Graphical User Interface (GUI) project. When prompted to give your project a name, name it "ASCII Translator."
Paste the following code to create the string you would like to get the ASCII characters for:
Dim s as String = "Hello."
Dim char() as Char = s.toCharArray()
Replace "Hello." with whatever string of characters you would like to translate.
Paste the following to iterate through each letter in the string, convert it to its ASCII value and print it to the screen:
For x as Integer = 0 to char.Length - 1
Dim v as Integer = Microsoft.VisualBasic.Asc(char(x))
Paste the following to pause the program and give the user a chance to view the results:
Click the green arrow to run the program. The results, if you leave the initial string as "Hello." will be:
- Photo Credit alphabet image by Blue Moon from Fotolia.com
How to Convert Hex to Binary in Visual Basic
Visual Basic can change from one number base to another with a bit of manipulation in some short lines of code. Numerous...
Chinese to English Translation Tools
Translating Chinese terms into English doesn't have to be difficult. A variety of free services, including online dictionaries, pop-up programs and Chinese...
How to Add a Tab Into a String on VB.NET
The Visual Basic for Microsoft .NET, or VB.NET, ... You need to use ASCII code 9 to add a tab into a...
How to Find a Character in a String in VBA
Finding a single character in a string using VBA is a special instance of finding one string within another. The process itself...
How to Format a String in ASCII Java
How to Format a String in ASCII Java. ... The American Standard Code for Information Interchange is ... How to Convert Characters...
How to Convert From UTF-8 to ASCII
... or American Standard Code for Information Interchange, ... range of world languages with different character sets. ASCII is a 7 ......
How to Use ASCII Characters in Text, Scripts and HTML
We're spoiled by word processing programs that easily let us add special characters like the degree symbol, dashes and ampersands into our...
How to Convert Hex to Byte in VB6
When learning to code in Visual Basic 6.0 (VB6), it's important to understand how to convert data types, such as a hexadecimal...
How to Use Control Characters With Oracle SQL
Here you will find the comprehensive list of decimal values for each control character at http://ascii ... Find the decimal value for...
How to Delete Hidden Characters in Word
"Word 2010 for Dummies ... How to Use Non-Printing Characters in Microsoft Word. Non-printing characters can be used in Microsoft Word by...