|
-
Dec 8th, 2002, 10:31 PM
#1
Thread Starter
Addicted Member
Coding for character-by-character from a textbox?
I want to make a text to binary converter, but i can't think of a way to take "abc" into "0110 0001 0110 0010 0110 0011".
unless I make like 50 textboxes, I don't think it's possible to convert like that with the information I have, which is really... really... tiny... tiny...
Ayway.
There has to be a way, right?
Would someone help me on this, please?
Thanks.
-
Dec 8th, 2002, 10:57 PM
#2
Addicted Member
You could do something like this:
VB Code:
Dim c As Char
Dim myStr As String = "ABC"
Dim o As String
For Each c In myStr 'Tells the computer to do something for each character in the string
o &= "add something to the string o, can be anything ex. 0010"
Next
Jeremy
-
Dec 13th, 2002, 04:51 PM
#3
Thread Starter
Addicted Member
Is there another way?
It seems like the code above won't properly convert a string with multiple same characters... I'm trying it now tho.
I just tried it, and if there were more than one For...Each statement, the result turned out.. weird.. iono..
Last edited by nahya^^; Dec 13th, 2002 at 04:57 PM.
-
Dec 15th, 2002, 09:55 AM
#4
Junior Member
Well I can get you a group of Hex values......
VB Code:
Dim I As Integer
Dim sData As String = "AAaaBBbbCCcc"
Dim sRtn, sTmp As String
For I = 1 To Len(sData)
sTmp = Hex(Asc(Mid(sData, I, 1))) & " "
sRtn = sRtn & sTmp
Next
MsgBox(sRtn)
Best,
Roger
VB6.0 SR5 & VB.Net Pro
-----------------------------------------------
Do or do not, there is no try!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|