I've seen some code for highlighting rows on a datagrid:
Trouble is, if you click a cell, hold down the mouse button and move off the row, it is still possible to edit the cell. I basically want a table where you single click to highlight, then double-click to open a new form to edit the data in that row. Surely must be a simple enough proposition?
Jon
"I don't regret this, but I both rue and lament it.
Code:
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dataGrid1.Select(hti.Row);
}
}
Jon
"I don't regret this, but I both rue and lament it.