Determines whether the specified key is a regular input key that the editing control should process or a special key that the DataGridView should process.
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic (Declaration)
Function EditingControlWantsInputKey ( _
keyData As Keys, _
dataGridViewWantsInputKey As Boolean _
) As Boolean
Dim instance As IDataGridViewEditingControl
Dim keyData As Keys
Dim dataGridViewWantsInputKey As Boolean
Dim returnValue As Boolean
returnValue = instance.EditingControlWantsInputKey(keyData, _
dataGridViewWantsInputKey)
bool EditingControlWantsInputKey(
Keys keyData,
bool dataGridViewWantsInputKey
)
bool EditingControlWantsInputKey(
Keys keyData,
bool dataGridViewWantsInputKey
)
function EditingControlWantsInputKey(
keyData : Keys,
dataGridViewWantsInputKey : boolean
) : boolean
Return Value
Type:
System..::.Boolean
true if the specified key is a regular input key that should be handled by the editing control; otherwise, false.
An editing control implements this method to determine which input keys should be processed by the control, and which input keys should be processed by the DataGridView.
The EditingControlWantsInputKey method is called by the DataGridView. The DataGridView will pass in true for dataGridViewWantsInputKey when it can process the keyData. If the editing control can let the DataGridView handle the keyData, EditingControlWantsInputKey should return false when dataGridViewWantsInputKey is true. Other implementations of EditingControlWantsInputKey may ignore a dataGridViewWantsInputKey value of true and handle the keyData in the editing control.
The following code example provides an implementation of this member. This example is part of a larger example available in How to: Host Controls in Windows Forms DataGridView Cells.
Public Function EditingControlWantsInputKey(ByVal key As Keys, _
ByVal dataGridViewWantsInputKey As Boolean) As Boolean _
Implements IDataGridViewEditingControl.EditingControlWantsInputKey
' Let the DateTimePicker handle the keys listed.
Select Case key And Keys.KeyCode
Case Keys.Left, Keys.Up, Keys.Down, Keys.Right, _
Keys.Home, Keys.End, Keys.PageDown, Keys.PageUp
Return True
Case Else
Return Not dataGridViewWantsInputKey
End Select
End Function
// Implements the IDataGridViewEditingControl.EditingControlWantsInputKey
// method.
public bool EditingControlWantsInputKey(
Keys key, bool dataGridViewWantsInputKey)
{
// Let the DateTimePicker handle the keys listed.
switch (key & Keys.KeyCode)
{
case Keys.Left:
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Home:
case Keys.End:
case Keys.PageDown:
case Keys.PageUp:
return true;
default:
return !dataGridViewWantsInputKey;
}
}
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference