Hi,
I am trying to add rows containing a button to a Datagridrow control and would like the button to be red. When I use the code below the button does not turn red but the cell containing the button does. How can I turn the button red? Thanks.
I am trying to add rows containing a button to a Datagridrow control and would like the button to be red. When I use the code below the button does not turn red but the cell containing the button does. How can I turn the button red? Thanks.
VB.NET:
Private Sub AddRow(ByVal Product As String, ByVal Stock As String)
Dim NewRow As DataGridViewRow = New DataGridViewRow
Dim CellButton As DataGridViewCell
CellButton = New DataGridViewButtonCell
CellButton.Value = Stock
CellButton.Style.BackColor = Color.Red
NewRow.Cells.Add(CellButton)
DataGridView1.Rows.Add(NewRow)
DataGridView1.AutoResizeColumns()
End Sub