Hmmm, I've spent about 5 hours trying to reslove this issue and I now
finally have a solution. Thanks Dmitriy for pointing me in the right
direction! Here's what worked for me:
public class LODataGrid : DataGrid
{
protected override bool ProcessDialogKey( Keys keyData )
{
//return true if the key should be processed; otherwise, false.
if( (Keys.Add == keyData || Keys.Subtract == keyData) )
{
return false; //Do NOT process this anymore
}
return base.ProcessDialogKey( keyData );
}
}
/Tomas R
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> skrev i
meddelandet news:uZ**************@TK2MSFTNGP10.phx.gbl...
Here's a solution:
override the ProcessKeyPreview method in a control inherited from the
DataGrid and add the following code:
if (msg.Msg == 0x100)
{
Keys keyPressed = Keys.KeyCode & (Keys)msg.WParam.ToInt32() ;
if (ModifierKeys == Keys.None && (Keys.Add == keyPressed ||
Keys.Subtract == keyPressed))
{
return false;
}
}
return base.ProcessKeyPreview(ref msg);
You might also need to add similar code to the ProcessCmdKey and
ProcessDialogKey methods.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Tomas R" <no*****@please.nu> wrote in message
news:uq**************@TK2MSFTNGP12.phx.gbl... Really weird. The ordinary plus/minus works, but not the ones on the
numpad?!
What I've bound to the datagrid is a DataView with a few columns having
numeric values with datatype Int32. (Comming from an SQL Server). The
column have a DataGridTextBoxColumn of course, and I found somewhere on the net
someone saying you could specify TextBox.Multiline = true on the
DataGridTextBoxColumn, but it already is and surely wont fix the
problem. Another place mentioning the problem is on
http://www.dotnet247.com/247referenc...26/133742.aspx, but that
workaround was a little to complicated I believe.
Are the numpad really supposed to work(or NOT work) like this or is it a
serious bug?
Thanks for any responses!
/Tomas R