Results 1 to 11 of 11

Thread: Anyone know how the DEL could be captured?

  1. #1

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    Anyone know how the DEL could be captured?

    in a textbox.. is it not possible to capture the DEL button when pressed? and do something with it.... as i couldint get it to work. It works fine for the Backspace though.

    Private Sub Text1_KeyPress(KeyAscii As Integer)

    if KeyAScii = 8 then 'this is for backspace..which works)
    do something
    end if

    ----
    however.. the following does not work.. which is for DEL

    if keyAscii = 127 then
    do something
    end if


    any ideas?
    cheers
    Abe
    1+1=3
    make life simple, use a calculator!

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Anyone know how the DEL could be captured?

    Originally posted by Abdulrahman
    in a textbox.. is it not possible to capture the DEL button when pressed? and do something with it.... as i couldint get it to work. It works fine for the Backspace though.

    Private Sub Text1_KeyPress(KeyAscii As Integer)

    if KeyAScii = 8 then 'this is for backspace..which works)
    do something
    end if

    ----
    however.. the following does not work.. which is for DEL

    if keyAscii = 127 then
    do something
    end if


    any ideas?
    cheers
    Abe
    Use this:
    Last edited by Nightwalker83; Dec 13th, 2007 at 07:46 PM.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    re:

    thanx but this does not show a value for the DEL button..

    i looked at some ASCII code charts... and it gave the ASCII value for DEL (Delete button) as 127.

    However I am finding no way of capturing the button to set off a few events when user does press the DEL button.

    any ideas anyone?

    Abe
    1+1=3
    make life simple, use a calculator!

  4. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    VB Code:
    1. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.  
    3.     If KeyCode = vbKeyBack Then
    4.         MsgBox "Rubout key pressed."
    5.     ElseIf KeyCode = vbKeyDelete Then
    6.         MsgBox "Delete key pressed."
    7.     End If
    8.  
    9. End Sub
    This world is not my home. I'm just passing through.

  5. #5
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: re:

    Originally posted by Abdulrahman
    thanx but this does not show a value for the DEL button..

    i looked at some ASCII code charts... and it gave the ASCII value for DEL (Delete button) as 127.

    However I am finding no way of capturing the button to set off a few events when user does press the DEL button.

    any ideas anyone?

    Abe
    Download the file again because I've changed it.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  6. #6

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    re:

    thanx..

    i was trying to get it to work on the Keypress event...along with the other ones..

    but i'v just found a workaround.. will just use sendkeys function

    thanks!
    Abe
    1+1=3
    make life simple, use a calculator!

  7. #7
    Si_the_geek
    Guest
    i have a value of 46 for Del on my VB ascii chart...

  8. #8
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344
    Originally posted by Si_the_geek
    i have a value of 46 for Del on my VB ascii chart...
    It Keycode not Ascii but your right about the 46.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  9. #9

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281
    yes but could you guys actaully do something with it??

    like if keyAscii = 46 then.......


    coz i couldint get that to work..

    Abe
    1+1=3
    make life simple, use a calculator!

  10. #10
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344
    Originally posted by Abdulrahman
    yes but could you guys actaully do something with it??

    like if keyAscii = 46 then.......


    coz i couldint get that to work..

    Abe
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 46 Then
    MsgBox ("Yes this works.")
    End If
    End Sub
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  11. #11

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281
    ah right keycode.. what I mean is that you cant use the KeyAscci codes.. for the DEL button.. keycode=46 works.. but KeyAscci = 127 does not.. anyhow... thanks a lot

    Abe
    1+1=3
    make life simple, use a calculator!

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