SelectNextControl

V

VJ

I am in the last row of my datagrid and in the last but one column. I don't
want the user to tab to the last column, but to my save button. How do I
accomplish this?, using SelectNextControl does not work.. I even tried
base.Parent.SelectNextControl, its of no use.. I have the code below..

private void dataGrid1_CurrentCellChanged(object sender,
System.EventArgs e)
{

int rowChanging = dataGrid1.CurrentCell.RowNumber;
DataTable table = dataSet.Tables[0];
int intMaxRows = tSheet.Rows.Count - 1;

if (dataGrid1.CurrentCell.ColumnNumber == 7)
{
if (dataGrid1.CurrentCell.RowNumber >= intMaxRows - 1 )
{
//Select the next control in tab order i.e the btnSave

dataGrid1.SelectNextControl(btnSave,true,false,true,true);

//dataGrid1.SelectNextControl(btnSave,true,false,true,true); - this does not
work either..

//base.parent.SelectNextControl(btnSave,true,false,true,true); - this does
not work either..
return;
}
//setfoucs to next rows first cell.
dataGrid1.CurrentCell = new DataGridCell(rowChanging + 1,1);
}

}

on debugging the "SelectNextControl" gets hit exactly when the user tabs out
of the last but one cell of the lastrow.. but the foucs does not get set to
the next control..

VJ
 
V

VJ

I am in the last row of my datagrid and in the last but one column. I don't
want the user to tab to the last column, but to my save button. How do I
accomplish this?, using SelectNextControl does not work.. I even tried
base.Parent.SelectNextControl, its of no use.. I have the code below..

private void dataGrid1_CurrentCellChanged(object
sender,System.EventArgs e)
{

int rowChanging = dataGrid1.CurrentCell.RowNumber;
DataTable table = dataSet.Tables[0];
int intMaxRows = table.Rows.Count - 1;

if (dataGrid1.CurrentCell.ColumnNumber == 7)
{
if (dataGrid1.CurrentCell.RowNumber >= intMaxRows - 1 )
{
//Select the next control in tab order i.e the btnSave

dataGrid1.SelectNextControl(btnSave,true,false,true,true);

//dataGrid1.SelectNextControl(btnSave,true,false,true,true); - this does not
work either..

//base.parent.SelectNextControl(btnSave,true,false,true,true); - this does
not work either..
return;
}
//setfoucs to next rows first cell.
dataGrid1.CurrentCell = new DataGridCell(rowChanging + 1,1);
}

}

on debugging the "SelectNextControl" gets hit exactly when the user tabs out
of the last but one cell of the lastrow.. but the foucs does not get set to
the next control..

VJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top