-
I posted this as a reply down the list some, but I was worried that no one would see it:
If in text1 someone enters "A",
I want text2 to output "1".
And if in text1 someone enters "B",
I want text2 to output "2".
But if someone entered "AB" in text1,
I want tex2 to display "12". Not just "1".
Get that?
That might be confusing, lt me know if you need any further explaning.
Thanks,
System
-
<?>
check your former post
:D
-
This will work for A=1 B=2 C=3 D=4...Y=25 Z=26
Code:
Private Sub Text1_Change()
Text2 = ""
For i = 1 To Len(Text1)
Char = Mid(Text1, i, 1)
If Not Asc(Char) = 32 Then Text2 = Text2 & Asc(UCase(Char)) - 64
Next i
End Sub
[Edited by Megatron on 09-09-2000 at 02:48 PM]
-
How about this?
Code:
Private Sub Text1_Change()
Dim s As String
Dim c As Long
Text1.Text = UCase(Text1.Text)
Text1.SelStart = Len(Text1.Text)
Text1.SelLength = 0
For i = 1 To Len(Text1.Text)
c = Asc(Mid(Text1.Text, i, 1))
If c <= vbKey9 And c >= vbKey0 Then
s = s & c
ElseIf c <= vbKeyZ And c >= vbKeyA Then
s = s & CStr((c - vbKeyA + 1))
End If
Next i
Text2.Text = s
End Sub
All letters are replaced with a number (A=1, B=2, etc). Numbers are entered straight.
-
2 going at once:
System
New Member
Registered: Sep 2000
Posts: 7
Sorry, I am confused.
What I am trying to do, is make a program that when you enter letters and numbers into text1, text2 will output the binary form of those letters.
EX:
Someone enters:
"ABC" into text1,
text2 will output:
" 0100 0001 0100 0 0100 1000011".
But I can't enter all the binary for each word, so i need each letter or number to addon its code to the nubers the text2.
-System