Here is an example of some code I'm using to select a particular column in a
datagrid:
private void subsystemsCellChanged(object sender, MouseEventArgs e)
{
string subsystemSearch = "";
DataGrid.HitTestInfo hitInfo = subsystemsDataGrid.HitTest(new Point(e.X,
e.Y));
if (hitInfo.Row < datatableIndexTab.Rows.Count && hitInfo.Row -1)
{
subsystemsDataGrid.Select(hitInfo.Row);
subsystemsDataGrid.CurrentCell = new DataGridCell(hitInfo.Row,
hitInfo.Column);
DataGridCell dc = subsystemsDataGrid.CurrentCell;
string txt = subsystemsDataGrid[dc].ToString();
// do more processing here
}
}
HTH
WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Suresh.P.R" wrote:
I am filling the Data Grid in the existing columns from the database.
In the Item_Command event of the Data Grid I am writing the code to be
execute while clicking on each item in the data grid. It is working. What is
the way for knowing which cell they click. With the item index I can get the
row. How I can get the column?
================Suresh