Type | Description | |||
KeyCode as Integer | An integer expression that indicates the key code being replaced. | |||
Integer | An integer expression that indicates the replaced key code. |
Use the Key property to replace the default action when a certain key is pressed. Use the KeyDown event to notify your application that the user presses a key. For instance, Key( vbKeyF2 ) = vbKeyF4 specifies that F2 and F4 keys do the same thing. By default, the F4 key opens the drop down window, so F2 will open the drop down window too.
The following VB sample disables the F4 key ( by default, the F4 key shows or hides the drop down portion of the control ):
ComboBox1.Key(vbKeyF4) = 0
The following VB sample specifies that user may open the drop down window using the F2 key, and can't open the drop down window using the F4 key:
With ComboBox1 .Key(vbKeyF2) = vbKeyF4 .Key(vbKeyF4) = 0 End With
The following C++ sample disables the F4 key ( by default, the F4 key shows or hides the drop down portion of the control ):
m_combobox.SetKey( VK_F4, 0 );
The following VB.NET sample disables the F4 key ( by default, the F4 key shows or hides the drop down portion of the control ):
With AxComboBox1 .set_Key(Convert.ToInt16(Keys.F4), 0) End With
The following C# sample disables the F4 key ( by default, the F4 key shows or hides the drop down portion of the control ):
axComboBox1.set_Key(Convert.ToInt16(Keys.F4), 0);
The following VFP sample disables the F4 key ( by default, the F4 key shows or hides the drop down portion of the control ):
with thisform.ComboBox1 .Key(115) = 0 && vkF4 endwith