Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 7th, 2006, 08:20 PM
Registered User
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to skyraider
Default Converting an ASCII character to binary?


I'm working on a program to encode and decode base64. I know there's a built-in method, but I want to do it myself to really learn something. My question is: how do I take the ASCII value of a letter and convert it to binary? Please see the second-to-last line.

        Dim UserInput As String = txtInput.Text
        Dim ASCIIinput(txtInput.Text.Length - 1) As Integer

        ' convert user input to ASCII numbers
        Dim i As Integer
        For i = 0 To (UserInput.Length - 1)
            ASCIIinput(i) = AscW(UserInput.Chars(i))

        ' /* starting encoding process */
        ' take three bytes from the input
        Dim i2 As Integer
        Dim ByteArray(ASCIIinput.Length - 1) As Byte
        For i2 = 0 To (ASCIIinput.Length - 1)
            ByteArray(i2) = CByte(ASCIIinput(i2))
            ' uhh... this just converts it to another 2-digit integer, just like the ASCII number... not an 8-bit binary number
I'm a total newbie here, but I am working through your VB 2005 book ;) Thanks!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Ascii code for a character in XSLT mswin XSLT 8 November 28th, 2008 08:21 AM
Converting a set of string to its ascii value... rittwick Beginning VB 6 4 April 2nd, 2007 10:46 AM
Get UNICODE or ASCII Value of a character Eyob_the_pro C# 0 January 10th, 2007 03:42 AM
Format of Inet Object in vb6..ASCII/BINARY? ksrmramu VB How-To 0 October 18th, 2005 02:45 AM
Differences between ASCII and Binary Files kuba C# 1 October 17th, 2004 07:22 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.