Results 1 to 4 of 4

Thread: Hmm. Ones and Zeros

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Question

    As long as my program runs, how do i restrict the characters to be entered into a txt box only to 1 and 0(for binaries)?api?
    Amon Ra
    The Power of Learning.

  2. #2
    Guest
    Try this:


    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        Select Case KeyAscii
            Case vbKey0
                Exit Sub
            Case vbKey1
                Exit Sub
            Case vbKeyBack
                Exit Sub
            Case Else
                KeyAscii = 0
        End Select
    End Sub

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Wink ok

    Great! thankx. btw, why does it say exit sub if it is 1 or 0?
    Amon Ra
    The Power of Learning.

  4. #4
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    it doesn't have to in his example. You could leave the case statements blank. The important one is the case else.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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