| | |
DataGridView
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2007
Posts: 13
Reputation:
Solved Threads: 0
hi
i have created one UI application using c#. i want to use PageDown Keys for navigate between rows, but when i press PageDown keys datagridview select last row.
How can i do this?
thanks in advance
my code:
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.PageDown)
{
int cRow=dataGridView1.CurrentRow.Index;
cRow += 1;
dataGridView1.CurrentCell = dataGridView1.Rows[cRow].Cells[0];
}
}
i have created one UI application using c#. i want to use PageDown Keys for navigate between rows, but when i press PageDown keys datagridview select last row.
How can i do this?
thanks in advance
my code:
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.PageDown)
{
int cRow=dataGridView1.CurrentRow.Index;
cRow += 1;
dataGridView1.CurrentCell = dataGridView1.Rows[cRow].Cells[0];
}
}
you maybe select another control!!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
I mean do u sure the gridview is selected in other meaning the focused control
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Nov 2006
Posts: 436
Reputation:
Solved Threads: 72
I assume what you want to do is trap the Page Down key and use it for navigating the datagridview. The problem in your code is that you are not telling the datagridview that you have aleady handle the key press.
Let it know that you have taken care of the key press by setting the Handled property to true.
This prevents the event from going into the internal key event handler of the DataGridView.
Let it know that you have taken care of the key press by setting the Handled property to true.
If using KeyPress then assign the KeyPressEventArgs e ... e.Handled = true; if using KeyDown then assign the KeyEventArgs e ... e.handled = true;
This prevents the event from going into the internal key event handler of the DataGridView.
![]() |
Similar Threads
- Image in DataGridView (C#)
- How to add rows from dataset to datagridview (C#)
- COMBOBOX VS DATAGRIDVIEW - resizing and positioning! (VB.NET)
- Searching a String in DataGridView FW 2.0 (C#)
- DataGridView EASY HELP (VB.NET)
- DataGridView - how to get invalid data in comboboxcell (C#)
- C# 2005 - ComboBoxes with Parent / Child relation in DataGridView (C#)
Other Threads in the C# Forum
- Previous Thread: C# codes
- Next Thread: Printer Help
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql nargalax networking object operator path photoshop picturebox pixelinversion polynomial post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






