I have a VB.NET 2003 application that uses several datagrids. The behaviour
I want from the datagrid is to select (highlight) the entire row when I
click on any cell in a row. I have done this using code from syncfuson.com
to create a class that inherits from DataGridTextBox Column and overrides the
its Edit method. i.e.
Public Class DataGridNoActiv eCellColumn
Inherits DataGridTexBoxC olumn
Private SelectedRow as Integer
Protected Overloads Overrides Sub Edit (ByVal source As CurrencyManager ,
ByVal rowNum as Integer...)
SelectedRow = rowNum
If (SelectedRow -1) and (SelectedRow < source.List.Cou nt) then
Me.DataGridTabl eStyle.DataGrid .Unselect(Selec tedRow)
Me.DataGridTabl eStyle.DataGrid .Select(Selecte dRow)
End if
End Sub
End Class
This works well. For certain grids, I want the user to be able to select
more than one row, and each selected row to be highlighted. To attempt to do
this I created another class similar to the above, but without the
Me.DataGridTabl eStyle.DataGrid .Unselect(Selec tedRow) line, and created my
DataGridTableSt yle using that, but it didn't work. How can I highlight
multiple rows at the same time in a .NET datagrid? Thanks in advance.
Andy Baker