473,406 Members | 2,847 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,406 software developers and data experts.

Capture tab in DataGrid problem

I have a particular column in a data grid which, when clicked, displays a
form with three text boxes on. I'm wanting to tab through these text boxes
but I'm having a bit of trouble because the data grid captures the tabs too.
I managed to get around it by putting the following on the form...

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Tab)
{
if (textBox1.Focused)
textBox2.Focus();
else if (textBox2.Focused)
textBox3.Focus();
else
textBox1.Focus();

return true;
}

return base.ProcessCmdKey(ref msg, keyData);
}

The problem that I'm having now is that when I press tab on textBox1 I get
an error message saying "Index 0 is not non-negative and below total rows
count. Do you want to correct the value?". I understand that this is because
the data grid is empty but if I put a message box directly above the "if
(textBox1.Focused)" line, when the text box closes it moves to textBox2
without any trouble. Also, if I put a breakpoint on "if (keyData ==
Keys.Tab)" and then click play as soon as the breakpoint is called it moves
on to textBox2 without any trouble.

The message box and the breakpoint are obviously doing something which is
stopping this error message from appearing. Does anyone know what it might be
and how I could replicate it myself to stop this error message from appearing?

Thanks,

Darrell

Nov 17 '05 #1
0 823

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

Similar topics

10
by: Tim Frawley | last post by:
I am attempting to detect a Shift+Tab in the KeyPress event for back navigation on a control that doesn't support this method. Does anyone have any ideas how to compare e.KeyChar to a ShiftTab? ...
3
by: Melson | last post by:
hi can anyone help me how can i capture ENTER keystroke when the cell in datagrid is in editing mode. I'm now creating a data entry form with primary key in header and details in datagrid. So...
0
by: crferguson | last post by:
I've been looking in every place I can to find a solution for this and I believe I've pieced a solid one together so I thought I'd share since I've found so much help on these groups... This is...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
2
bplacker
by: bplacker | last post by:
This seems like a simple question but, obviously, I cannot figure it out. I have a form which comes up with a datagrid, and from this datagrid I open up an edit form with the selected record from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.