Hi all,
I have a DataGridView with ComboBox inside a cell and it seems to work properly. What I want to do is to be able to change the background color of the row based on what the user selects from the drop down ComboBox.
Lets say the ColumnHeaderCell is "Colors" and the ComboBox is a cell and has a list of "Red," "Yellow" and "Green." If you select "Green" the background color of that ROW would be green.
Private Sub DataGridView1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If Me.DataGridView1.Columns(e.ColumnIndex).HeaderText = "Colors" Then
e.CellStyle.BackColor = Color.Yellow
The above code only change the background color of single cell, but I want the row.
Thanks and Regards,
I have a DataGridView with ComboBox inside a cell and it seems to work properly. What I want to do is to be able to change the background color of the row based on what the user selects from the drop down ComboBox.
Lets say the ColumnHeaderCell is "Colors" and the ComboBox is a cell and has a list of "Red," "Yellow" and "Green." If you select "Green" the background color of that ROW would be green.
Private Sub DataGridView1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If Me.DataGridView1.Columns(e.ColumnIndex).HeaderText = "Colors" Then
e.CellStyle.BackColor = Color.Yellow
The above code only change the background color of single cell, but I want the row.
Thanks and Regards,