How can I highlight an entire datagrid row by clicking anywhere in a row?
I tried the following:
DataGrid1.Select(DataGrid1.CurrentCell.RowNumber)
In the CurrentCellChanged event but it changes the appearance of the selected cell. Any ideas?
Printable View
How can I highlight an entire datagrid row by clicking anywhere in a row?
I tried the following:
DataGrid1.Select(DataGrid1.CurrentCell.RowNumber)
In the CurrentCellChanged event but it changes the appearance of the selected cell. Any ideas?
Hi
Just study this with code example. can be in help
http://www.dotnetbips.com/displayarticle.aspx?id=205
brgds
Krasimir
I put this in the MouseUp event:
Dim pt = New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)
If hti.Type = DataGrid.HitTestType.Cell Then
DataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column)
DataGrid1.Select(hti.Row)
End If
Can also try this row in CurrentCellChanged event:
DataGrid1.Select(DataGrid1.CurrentRowIndex)
http://www.freevbcode.com/ShowCode.asp?ID=5746
this is a great sample code example of how to do this plus a few other little things that may be useful. works great out of the box, and was easy to add to a project with very little modding to get it to work.
I found it and just thought it may help some others who need this too.
This example is for use with a winform.
Looks good, thanks vbxPuppet. I got this solved for long ago, but it's a good example to anybody who needs it...
As you are interested in Winforms Datagrids, maybe you know some handy way to apply "autocomplete" in Datagrid ComboBox - i.e. getting first matching result by typing the first letters...
I know how to do it in normal ComboBox, but not in Datagrid... Would you have any good code sample for such of Class or any tips..?
(Framework 1.1)
sorry but no,
I also have now moved all my projects to 05, and framework 2.0
the datagridview is worth the upgrade alone, plus all the other really kewl stuff they shoved up vs's ars ;>