Results 1 to 2 of 2

Thread: what about this ?

  1. #1

    Thread Starter
    Member lllld_bllll's Avatar
    Join Date
    Dec 2001
    Location
    In The Hell , Die and visit me :D
    Posts
    42

    Question what about this ?

    is this a possible code to prevent typing a letter ?

    code : text1_change
    if val(text1.text),(len(text1.text)-1))=0 _
    and mid(text1.text),(len(text1.text)-1)) <> 0 then
    command1.enable = false

    thanks for reading
    lllld_bllll
    ....... You'll Never Know

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    One trick is to use the KeyPress event;

    Sub TextBox1_KeyPress(KeyAscii As Integer)
    If KeyAscii = ASC("B") Then KeyAscii = 0
    End Sub

    Now the user cannot type a capital B into the box. This doesn't prevent them copying and pasting one in though.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

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