How to focus one cell from another in gridview by c#

Posted by Suriyag under C# on 12/17/2012 | Points: 10 | Views : 1675 | Status : [Member] | Replies : 0
Hi,
I want move the focus cell to another cell in datagridview (i.e) cell[0] to cell[3] like for entire datagridview.

My following coding has done it for only one row.
for loop is not suitable for my requirement, because i am creating row at runtime only. so it takes rowcount= 1.



private void dataGridView1_KeyUp(object objSender, KeyEventArgs objArgs)
{
if (dataGridView1.CurrentCell.ColumnIndex == 0)
{
if(objArgs.KeyCode==Keys.Tab)
{
try
{
int[] p = new int[dataGridView1.Rows.Count - 1];
for (int i = 0; i <= p.Length; i++)
{
dataGridView1.Focus();
dataGridView1.Select();
dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[3];

}}
catch
{
}}


Is there any possible for entire datagridview.?

Thanks,
Regards
Suriya...

SuriyaPrakash


Responses

(No response found.)

Login to post response