Chnange Cell Color + GridView

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Chnange Cell Color + GridView

 
0
  #1
Oct 7th, 2009
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?


  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Try
  3.  
  4. Dim row0 As String() = {TextBox1.Text, TextBox2.Text}
  5. DataGridView1.Rows.Add(row0)
  6. row0 = Nothing
  7.  
  8. Catch ex As Exception
  9. MsgBox(ex.Message)
  10. End Try
  11. End Sub
  12.  
  13.  
  14. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  15. Try
  16.  
  17. DataGridView1.Item(1, 1).Value = 100
  18. 'What to write to chnage the cell color
  19.  
  20. Catch ex As Exception
  21. MsgBox(ex.Message)
  22. End Try
  23. End Sub
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC