473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help overriding key combination on datagrid

I'm tring to override the combination all the combination like this one Ctrl
+ Shift + [another key]. I just can't catch it... I have already done this
for ctrl + [any other key] or Shift + [any other key] but for both at same
timeI can't do it....

Can someone tell me how to do it
Here is an example of how I am doing this:
if ((msg.Msg == WM_KEYDOWN) && (keyCode == Keys.Down))
{
if (Control.ModifierKeys == Keys.Shift)
{
return true;
}
}
Nov 17 '05 #1
1 1755
Hi Diago,
I would create a control that inherits from DataGrid then override the
ProcessCmdKey method to catch your key combination. The keyData field is a
logical ORing of all currently pressed keys, so an example of how to catch a
Ctrl + Shift + P key combination pressed by the user is given below:

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
//Want to catch ctrl + shift + P
Keys keyCombination = Keys.Control | Keys.Shift | Keys.P;

if ((keyData & keyCombination) == keyCombination)
{
//do whatever you want to do.
}

return false;
}

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Diogo Alves - Software Developer" wrote:
I'm tring to override the combination all the combination like this one Ctrl
+ Shift + [another key]. I just can't catch it... I have already done this
for ctrl + [any other key] or Shift + [any other key] but for both at same
timeI can't do it....

Can someone tell me how to do it
Here is an example of how I am doing this:
if ((msg.Msg == WM_KEYDOWN) && (keyCode == Keys.Down))
{
if (Control.ModifierKeys == Keys.Shift)
{
return true;
}
}

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dietmar Gräbner | last post by:
Hi Right now I'm dealing with derivation by restriction and I have some questions concerning the attribute property use in context of the derivation. Consider following Schema: <xs:schema...
2
by: Dmitry Karneyev | last post by:
Hi! I'm using DataGrid in windows form. I need to implement the following functionality: - any mouse must select a row according where mouse has been clicked - context menu must be also...
0
by: VM | last post by:
Is there any way to override the event that adds an empty row to the datagrid when I click on the Tab key? Instead of adding the row to the datagrid, I'd like it to run a user-defined method. If...
2
by: chuckdfoster | last post by:
I have an database with a list of deparments (tblDepts). I need a web page that lists these departments with a textbox beside them for a score. I then need the user to score each department and...
6
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between...
4
by: Phill. W | last post by:
Here's a knotty little problem. I have some nasty little controls that needs to behave in a non- windows-Standard way - don't ask why; it's a large application being converted from some older...
0
by: Greg | last post by:
I've made a standard datagrid multi line. However, the mutiple lines of text are only visible when a row is selected. This is a common issue and the solution offered is always to override the...
1
by: tshad | last post by:
I have a DataGrid where I want the text in the cells to be black. But I want the header to have a black background and white text. The problem is the settings in the DataGrid are not overriding...
2
by: cus129 | last post by:
Help Please!!!!!!!! I am using VS 2003 and developing windows application. My question is how to highlight or change the color of the whole row in a DataGrid when a criteria is met on form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.