BUG: KeyPad PLUS SIGN (+) and MINUS SIGN (-) Do Not Appear in DataGrid Control with Visual Basic .NET (328590)
The information in this article applies to:
- Microsoft Windows .NET Framework 1.1
- Microsoft .NET Framework 1.0 SP2
This article was previously published under Q328590 SYMPTOMS In the Windows Forms DataGrid control, when you use KeyPad
to type PLUS SIGN (+) or MINUS SIGN (-), these symbols do not appear in the
DataGrid control. RESOLUTION To resolve the problem, you must inherit your own datagrid
class from System.Windows.Forms.DataGrid class, and then override the following functions:
The following code demonstrates this resolution:
Public Class MyDataGrid
Inherits System.Windows.Forms.DataGrid
Protected Overrides Sub OnKeyDown(ByVal ke As System.Windows.Forms.KeyEventArgs)
Select Case ke.KeyCode
Case Keys.Add
ke = New KeyEventArgs(ke.Modifiers Or Keys.Oemplus)
Case Keys.Subtract
ke = New KeyEventArgs(ke.Modifiers Or Keys.OemMinus)
End Select
MyBase.OnKeyDown(ke)
MyBase.ProcessGridKey(ke)
End Sub
Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.Add
Return MyBase.ProcessDialogKey(Keys.Oemplus)
Case Keys.Subtract
Return MyBase.ProcessDialogKey(Keys.OemMinus)
Case Else
Return MyBase.ProcessDialogKey(keyData)
End Select
End Function
Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
Const WM_KEYDOWN As Integer = &H100
If m.Msg = WM_KEYDOWN Then
Dim ke As New KeyEventArgs(CType(m.WParam.ToInt32(), Keys) Or ModifierKeys)
Select Case ke.KeyCode
Case Keys.Add
ke = New KeyEventArgs(Keys.Oemplus Or ModifierKeys)
Case Keys.Subtract
ke = New KeyEventArgs(Keys.OemMinus Or ModifierKeys)
End Select
Return MyBase.ProcessGridKey(ke)
End If
Return MyBase.ProcessKeyPreview(m)
End Function<BR/>
End Class
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
REFERENCESFor additional information in a C# version of this article, click
the article number below to view the article in the Microsoft Knowledge Base: 329333 BUG: KeyPad PLUS SIGN (+) and MINUS SIGN (-) Do Not Appear in DataGrid Control with C#
Modification Type: | Major | Last Reviewed: | 6/28/2004 |
---|
Keywords: | kbVS2003Swept kbbug kbNetFrame100preSP3fix kbpending KB328590 |
---|
|