|
-
Sep 9th, 2000, 12:52 PM
#1
Thread Starter
Junior Member
Ok, heres the scoop:
I have two text boxes, I want to set it up so that if someone entered:
"blah"
into the first text box, the second text box would display
"boo!"
etc...
Anyone know?
Thanks,
System
-
Sep 9th, 2000, 12:59 PM
#2
_______
<?>
Option Explicit
Private Sub Text1_Change()
If Text1 = "blah" Then Text2 = "boo"
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 01:15 PM
#3
Thread Starter
Junior Member
Almost
If in text1 someone enters "A",
I want text2 to output "1".
If in text1 someone enters "B",
I want text2 to output "2".
But if someone entered "AB",
I want it to display "12". Not 1.
That might be confusing, lt me know if you need any further explaning.
Thanks,
System
-
Sep 9th, 2000, 01:33 PM
#4
_______
<?>
same old just a little more work to do
you need to look up the ascii character set
for example a = 97
'and on and on
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim strString
strString = Text2.Text
If KeyAscii = 97 Then Text2 = strString & 1
If KeyAscii = 98 Then Text2 = strString & 2
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 01:48 PM
#5
Thread Starter
Junior Member
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:
"010000010100001001000011".
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
-
Sep 9th, 2000, 08:02 PM
#6
I take no credit for these functions(Base2Dec, and Dec2Base) Kedaman wrote them...
Code:
Function Base2Dec(val$, base%): Dim n%, a() As Byte
a = StrConv(UCase(val), vbFromUnicode)
For n = 1 To Len(val)
Base2Dec = CDec(Base2Dec + (a(n - 1) - 48 + 7 * (a(n - 1) > 64)) * base ^ (Len(val) - n))
Next n
End Function
Function Dec2Base$(val, base%): Dim n%, s
For n = 0 To 100
s = Int(val / base ^ n)
If s = 0 Then Exit For
s = s - Int(s / base) * base 's mod base
Dec2Base = Chr(s + 48 - 7 * (s > 9)) & Dec2Base
Next n
End Function
Private Sub Form_Load()
Text1 = ""
Text2 = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text2 = Text2 & " " & Dec2Base(KeyAscii, 2)
End Sub
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
|