?
Solved

selecting the entire row in a datagrid when the user clicks on a cell in the row

Posted on 2005-05-16
2
Medium Priority
?
200 Views
Last Modified: 2012-06-21
I have tried the code below but the entire row still isn't selected only the cell clicked on:

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);
 
     }
 
}
 
0
Comment
Question by:TerryBurger
2 Comments
 
LVL 21

Accepted Solution

by:
Yurich earned 750 total points
ID: 14015347
i had to do it in both mouse_down and mouse_up events

regards,
yurich
0
 

Author Comment

by:TerryBurger
ID: 14020145
I tried doing it in both events and it still only selects the single cell.  I even tried putting dataGrid1.Select(1) in a button to see if that would work but that didn't select the first row like it should have? Is there a command I'm missing maybe?
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question