Results 1 to 5 of 5

Thread: A=1,B=2. AB=12 right?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Texas
    Posts
    26

    Cool

    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

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    check your former post
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    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]

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    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

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width