I would like to change the BackColor a datagridview row. While searching around it 's clear that I will have to access the GridDataRowElement or GridDataCellElement to do it. From that after creating a variable of the type we can call something RowElement.BackColor = Color.Gray or CellElement.BackColor = Color.Gray
I have already tried this but it only colors row while the mouse is hovering at it (very strange...)
Now with the code below as a pointer, my problem is that I'm trying to cast a gridview row as GridDataRowElement it always results in epic failure.
Next
Could someone please point me to the right direction on how this can be done?
Thanks
I have already tried this but it only colors row while the mouse is hovering at it (very strange...)
Dim
rwInfo
As
GridViewRowInfo = myGrid.Rows(i)
myGrid.GridViewElement.TableElement.GetRowElement(rwInfo).BackColor = System.Drawing.Color.PaleGoldenrod
Now with the code below as a pointer, my problem is that I'm trying to cast a gridview row as GridDataRowElement it always results in epic failure.
For
i = 0
To
myGrid.Rows.Count - 1
Dim
r
As
GridViewRowInfo = myGrid.Rows(i)
Dim
rwInfo
As
GridViewRowInfo = myGrid.Rows(i)
For
Each
cInfo
As
GridViewCellInfo
In
rwInfo.Cells
Dim
row
As
GridDataRowElement = TryCast(myGrid.Rows(i), GridDataRowElement)
NextFor
Each
c
In
myGrid.Columns
Dim
cell
As
GridDataCellElement =
CType
(rwInfo.Cells(c.Index), GridDataCellElement)
NextNext
Could someone please point me to the right direction on how this can be done?
Thanks