Hi All, does anyone know why this doesn’t break for for CTRL-C in the KeyDown event of a ListBox? I noticed it in 2020r2, but tried it in 2015r4.1 and has the same behavior. CTRL-Z, CTRL-X and CTRL-V all break as expected. But CTRL-C doesn’t register. I thought it may have something to do with the system interfering with the event, but I would think it would happen with CTRL-X as well if that were the case. Any ideas as to why it will not get to the break for that section?
If Keyboard.AsyncControlKey = True Then ' Control key Select Case True Case Keyboard.AsynckeyDown(&h06) ' z key Break ' code breaks Case Keyboard.AsynckeyDown(&h07) ' x key Break ' code breaks Case Keyboard.AsynckeyDown(&h08) ' c key Break ' doesn't break Case Keyboard.AsynckeyDown(&h09) ' v key Break ' code breaks End Select End If
I read somewhere on the forum to not use AsyncKeyDown in the KeyDown event so I simplified it some and still can’t get it to go into the KeyDown event when CTRL-C is pressed. z, x, and v work just fine:
If Keyboard.ControlKey = True Then Select Case Asc(Key) Case 22 ' v Break Case 24 ' x Break Case 26 ' z Break End Select
I assume there is some reason for this, but I can’t figure out why the c key works differently than the others when CTRL is pressed at the same time. If it is just the ‘c’ key by itself, I can pick it up in the KeyDown event, but not if the Control key is pressed at the same time.