How to set keyboard events as mouse click events in VB

Updated on technology 2024-04-14
2 answers
  1. Anonymous users2024-02-07

    Some of the content is posted to filtering.,Please see ** for incomplete content.。

    private sub cmda click() This is the click event of the A command button, please add the specific handling here.

    end sub

    private sub cmdb click() This is the click event of the b command button, please add the specific handling here.

    end sub

    Private Sub cmdc click() This is the click event of the C command button, please add the specific handling here.

    end sub

    private sub cmdd click() This is the click event of the d command button, please add the specific handling here.

    end sub

    private sub cmda_keyup(keycode as integer, shift as integer) 'This is the key event of the A command button, in order to make the focus respond on other controls, you need to add the following call to the keyup event of other controls in the form that can get focus.

    keyuptodo keycode, shift 'Invoke the handler.

    end sub

    private sub keyuptodo(keycode as integer, shift as integer) 'Here's how to deal with it.

    select case ucase(chr(keycode))case<>

  2. Anonymous users2024-02-06

    I wrote it briefly.

    There are two controls: commanda, commandbprivate sub form load() = true

    end sub

    private sub commanda_click()msgbox "a"

    end sub

    private sub commandb_click()msgbox "b"

    end sub

    private sub form_keydown(keycode as integer, shift as integer)

    if keycode = vbkeya thencommanda_click

    elseif keycode = vbkeyb thencommandb_click

    end if

    end sub

    Hope it helps.

Related questions
5 answers2024-04-14

The following methods are for reference.

Method 1: Use the sendkeys statement. >>>More

7 answers2024-04-14

Do sports, such as: playing basketball, table tennis, etc.

6 answers2024-04-14

First of all, we need a very powerful software, blue

Because this software is installed in English, so you need a little English foundation, if you don't understand English, please keep clicking next to the end, it is not recommended to change the default installation path here, because I changed it once before, and there were a lot of problems. This is what it looks like when the installation is complete. >>>More

9 answers2024-04-14

Hello landlord: solo bit, commonly known as AD or order. Mainly responsible for 2T, disrupting the enemy's formation and team battle rhythm. >>>More

6 answers2024-04-14

In college, none of the methods I made to make friends were secretive, and they were all well-known advice. As a senior, I'm going to talk about how to make friends. >>>More