944,161 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 1322
  • VB.NET RSS
Oct 7th, 2009
0

Chnange Cell Color + GridView

Expand Post »
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?


VB.NET Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Oct 7th, 2009
0
Re: Chnange Cell Color + GridView
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Recent Interview Question
Next Thread in VB.NET Forum Timeline: Timeout Expired





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC