Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 7th, 2006, 08:20 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to skyraider
Default Converting an ASCII character to binary?

Hi,

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.

Code:
        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))
        Next

        ' /* 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
        Next
I'm a total newbie here, but I am working through your VB 2005 book ;) Thanks!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.