How can I select the full row in a datagrid? I tried the code below (from
the Syncfusion windows forms faq), so that all the cells of a row are
selected when I click on a single cell, BUT this has the effect of not
allowing multiple rows selection (ctrl-click or shift-click). How can I fix
this?
Thanx!
private void DataGrid_MouseUp(object sender, MouseEventArgs e)
{
DataGrid dg = (DataGrid)sender;
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dg.HitTest(pt);
if (hti.Type == DataGrid.HitTestType.Cell)
{
dg.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dg.Select(hti.Row);
}
}
Gary Vidal - 29 Jul 2004 18:03 GMT
This code worked for me.
Private Sub dgList_RowChanging(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dglist.CurrentCellChanged
dglist.Select(dglist.CurrentCell.RowNumber)
End Sub
> How can I select the full row in a datagrid? I tried the code below (from
> the Syncfusion windows forms faq), so that all the cells of a row are
[quoted text clipped - 15 lines]
> }
> }
Dan - 30 Jul 2004 10:24 GMT
Thanks, but I keep getting the same problem: with any of the two solutions I
can select multiple rows with ctrl/shift-click ONLY if I click on the
leftmost portion of the grid (where the small triangle 'cursor' is shown);
when I click on a row cell the whole row is selected, but only 1 row at once
can be selected (when I ctrl/shift-click onto another row's cell, the
previous row is deselected).
Any idea?
> This code worked for me.
>
[quoted text clipped - 4 lines]
>
> End Sub
Gary Vidal - 30 Jul 2004 22:03 GMT
I tested the function it seems that if you double click the row header (the little box next to the row) it will select a row. Its weird but it works
> Thanks, but I keep getting the same problem: with any of the two solutions I
> can select multiple rows with ctrl/shift-click ONLY if I click on the
[quoted text clipped - 12 lines]
> >
> > End Sub