DataGridView

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 13
Reputation: faranak is an unknown quantity at this point 
Solved Threads: 0
faranak faranak is offline Offline
Newbie Poster

DataGridView

 
0
  #1
Sep 21st, 2007
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];

}
}
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: DataGridView

 
0
  #2
Sep 21st, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 13
Reputation: faranak is an unknown quantity at this point 
Solved Threads: 0
faranak faranak is offline Offline
Newbie Poster

Re: DataGridView

 
0
  #3
Sep 22nd, 2007
No, I want to use this control
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: DataGridView

 
0
  #4
Sep 22nd, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 57
Reputation: Exelio is an unknown quantity at this point 
Solved Threads: 0
Exelio Exelio is offline Offline
Junior Poster in Training

Re: DataGridView

 
0
  #5
Sep 24th, 2007
hi,

try using the SelectionChanged event of the datagridview. you can use arrow keys to navigate through the records and this event gets fired automatically.


Hope this helps.


Regards

Exelio
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 436
Reputation: JerryShaw is on a distinguished road 
Solved Threads: 72
JerryShaw JerryShaw is offline Offline
Posting Pro in Training

Re: DataGridView

 
0
  #6
Sep 25th, 2007
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.
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC