473,395 Members | 1,516 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,395 software developers and data experts.

Using up and down arrow keys in datagridview


I have combobox column in DataGridView.
Up and down error keys should be used to navigate previous and next row in
grid.

For this I override them in ProcessCmdKey() event.

When combobox dropdown menu is open arrow arrow keys should move to previous
and next item in
dropdown menu instead of moving betveen rows.
How to check that combobox dropdown menu is open in ProcessCmdKey() ?

Andrus.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {

const int WM_SYSKEYDOWN = 0x104;

if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) {
switch (keyData) {
case Keys.Down:
if (this.CurrentCell is DataGridViewComboBoxCell) {
CurrentCell = Rows[CurrentCell.RowIndex +
1].Cells[CurrentCell.ColumnIndex];
return true;
}
break;

case Keys.Up:
if (this.CurrentCell is DataGridViewComboBoxCell) {
CurrentCell = Rows[CurrentCell.RowIndex -
1].Cells[CurrentCell.ColumnIndex];
return true;
}
break;
}
return base.ProcessCmdKey(ref msg, keyData);
}
May 30 '07 #1
0 2815

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

Similar topics

3
by: dreamer | last post by:
I am making a program for a friend with a disability. I need to adjust his audio volume using the keyboard as he cannot use a mouse. Any suggestions as to how I can raise the volume using the up...
52
by: Dick Moores | last post by:
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, <http://mathworld.wolfram.com/Base.html>, but I really don't understand it well enough....
5
by: skipc | last post by:
Hi, I am stuck... I've got a popup window that displays a list in table format with links on the bottom to navigate the list <prev> 1 2 3 ... <next> When I demo'd to the users... they...
10
by: Ivan V via DotNetMonster.com | last post by:
Hi All: How can I activate the spacebar to pull down the combobox? For instance, once the tab stopped at the combobox, suppose i can use dnarrow or F4 to pull down the combobox to make...
10
by: Bob | last post by:
Hello: I'm tring to make the down arrow act as a tab key and the up arrow act as like (-TAB.). I have this for the down arrow but nothing happens. Protected Overrides Function...
3
by: ayiha | last post by:
Problem statement: You might have come across a puzzle which contains 15 numbered square pieces, which can be moved horizontally or vertically. A possible arrangement of these pieces is shown...
3
by: bhuvragu | last post by:
Hi , I am new to html_ajax which is part of PEAR package. I have created a demo on html_ajax. Demo is when the user types text in a text field, it would display the relevant matching words and...
2
by: Artie | last post by:
Hi, I want to force the user to only use the drop down and calendar to select a date in the DatetimePicker control. I do NOT want them to select the control, then use the up and down arrow...
0
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
When I have an editable combobox in a DataGridView and the user tries to correct an error they can not move the cursor from character to character with the arrow keys. The arrow keys move focus...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.