DataGrid highlight

  • Thread starter Thread starter Bart
  • Start date Start date
B

Bart

Hi,
I am using C# and want to highlight an entire row in a
DataGrid when I click the row. I tried this in VB and it
works, however in C# I cannot get it to work properly.
I have an MousDown event that tells me which row I
clicked and then I try to do:

dgCustomers.CurrentCell = new DataGridCell(hti.Row,
hti.Column);
dgCustomers.Select(hti.Row);

This selects the row, but doesn't give it the highlight
look you get when you click the rowheader in a datagrid.
(Note: Datagrid is disabled for editing as well)

Is there another event that fires after you click on a
cell that has to be overriden in C#? Because the same code
( 2 lines )works fine in VB.net

thanks in advance,
Bart
 
Hi,
I am using C# and want to highlight an entire row in a
DataGrid when I click the row. I tried this in VB and it
works, however in C# I cannot get it to work properly.
I have an MousDown event that tells me which row I
clicked and then I try to do:

dgCustomers.CurrentCell = new DataGridCell(hti.Row,
hti.Column);
dgCustomers.Select(hti.Row);
try this:

private void gridMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hit = dataGrid.HitTest(pt);
if( e.Button == MouseButtons.Left &&
hit.Type == DataGrid.HitTestType.Cell )
{
dataGrid.Select(hit.Row);
}
}
Steve Alpert
my email (e-mail address removed) is encrypted with ROT13 (www.rot13.org)
-------------------------------------------
NOTICE OF CONFIDENTIALITY
-------------------------------------------
The information in this email, including attachments, may be confidential
and/or privileged and may contain confidential health information. This
email is intended to be reviewed only by the individual or organization
named as addressee. If you have received this email in error please
notify IDX immediately--by return message to the sender or to
(e-mail address removed)--and destroy all copies of this message and any
attachments. Please note that any views or opinions presented in this
email are solely those of the author and do not necessarily represent
those of IDX. Confidential health information is protected by state and
federal law, including, but not limited to, the Health Insurance
Portability and Accountability Act of 1996 and related regulations.
 
Back
Top