[RESOLVED] Change Cell Color + GridView
I want to change the value & its backcolor of cell.
On Button1_Click,I m adding records to the Gridview.
On Button3_Click,I want to chnage the value of cell & its backcolor.
Suppose two Rows & two columns are there in Grdiview
1 10
2 20
Suppose I want to change the value of item(Row=2,Colomn=2) to 100. I change the value but i m not ablt to change the backcolor.Can somebody tell me?
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim row0 As String() = {TextBox1.Text, TextBox2.Text}
DataGridView1.Rows.Add(row0)
row0 = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
DataGridView1.Item(1, 1).Value = 100
'What to write to chnage the cell color
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Re: Change Cell Color + GridView
Code:
dataGridView1.Rows[0].Cells[0].Style.BackColor = Color.Red;
Re: [RESOLVED] Change Cell Color + GridView
Re: [RESOLVED] Change Cell Color + GridView
Tell me one thing more that is it possible to change all colors of row of Griview widout using any for loop( For RowNum = 0 To DataGridView1.RowCount - 2)
Re: [RESOLVED] Change Cell Color + GridView
Are you looking for this one ?
Code:
dataGridView1.Rows[0].DefaultCellStyle.BackColor = Color.Red;
Re: [RESOLVED] Change Cell Color + GridView
Suppose there are 10 rows in Gridview,Is it poss to chnage all the 10 rows backcolor at once,Without uisng any Gridview Row loop
Re: [RESOLVED] Change Cell Color + GridView
Here it is
Code:
dataGridView1.DefaultCellStyle.BackColor = Color.Red;
Re: [RESOLVED] Change Cell Color + GridView