Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid highlight row

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
GB
I've seen some code for highlighting rows on a datagrid:
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); 
  } 
}
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top