How do I select an entire row when datagridview editmode property is set to EditOnEnter


A

Amit

Hi,

Can anyone give me the solution of selecting an entire row when
datagridview editmode property is set to EditOnEnter.

Thanks,
Amit
 
Ad

Advertisements

G

Guest

I am not real sure what you are asking, but here is some code I use to select
an entire row when any cell on the row has been clicked. I use the
HitTestInfo object, and then make sure that the click is actually in a row
that is populated, then select the row.

private void testpointsCellChanged(object sender, MouseEventArgs e)
{
DataGrid.HitTestInfo hitInfo = testPointDatagrid.HitTest(new Point(e.X,
e.Y));
if (hitInfo.Row < datatableTestPointTab.Rows.Count && hitInfo.Row > -1)
{
testPointDatagrid.Select(hitInfo.Row);
}
}

HTH

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top