|
-
Feb 18th, 2004, 07:47 AM
#1
Thread Starter
Addicted Member
Datagrid: Selected Cell
Hi,
I have a datagrid. I have some code to select the entire row if a cell is clicked on:
Code:
dataGrid1.Select(dataGrid1.CurrentCell.RowNumber);
When this fires, it does select the entire row, but it also leaves the cursor in the selected cell and the background colour changes and basically looks rubbish.
I cant think of a way to stop this - I want the behaviour to be the same as clicking on a row header (which I have hidden for this excercise).
Please can somebody help me???
Thanks,
DJ
-
Mar 4th, 2004, 02:14 PM
#2
Not sure i understand your problem, but here is how i select a row. If its not what you are looking for, please ignore this post.
Change the dgContact to your datagrid name, and paste this in your project.
Code:
private void dgContact_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dgContact.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
dgContact.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dgContact.Select(hti.Row);
}
}
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|