Guest User

Untitled

a guest
Mar 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. Private Sub BooksDataGridView_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles BooksDataGridView.CellFormatting
  2. For Each row As DataGridViewRow In BooksDataGridView.Rows
  3. If row.Cells("Edit").Value = False Then
  4. row.Cells(0).Style.BackColor = Color.FromArgb(0, 41, 75)
  5. Else
  6. row.Cells(0).Style.BackColor = Color.SeaGreen
  7. row.Cells(0).Style.SelectionBackColor = Color.MediumSeaGreen
  8. End If
  9.  
  10. Next
  11. For i As Integer = 0 To DataGridView1.RowCount - 1
  12. Dim tid = DataGridView1.Rows(i).Cells(0).Value
  13. Dim sid = DataGridView1.Rows(i).Cells(1).Value
  14. Dim type = DataGridView1.Rows(i).Cells(2).Value
  15. For j As Integer = 0 To BooksDataGridView.RowCount - 1
  16. If BooksDataGridView.Rows(j).Cells(1).Value = tid And BooksDataGridView.Rows(j).Cells(2).Value = sid And type = "Book" Then
  17. BooksDataGridView.Rows(j).Cells("Edit").Value = True
  18. BooksDataGridView.Rows(j).Cells("stat").Value = 1
  19. End If
  20. Next
  21. Next
  22. 'BooksDataGridView.Sort(BooksDataGridView.Columns(20), System.ComponentModel.ListSortDirection.Descending)
  23. End Sub
  24.  
  25. | Book Title Author |
  26. |☐ Harry Potter 1 J.k Rowling|
  27. |☑ Harry Potter 2 J.k Rowling|
  28. |☐ Harry Potter 3 J.k Rowling|
  29. |☑ Harry Potter 4 J.k Rowling|
  30. |☐ Harry Potter 5 J.k Rowling|
  31. |☑ Harry Potter 6 J.k Rowling|
  32. |☑ Harry Potter 7 J.k Rowling|
  33.  
  34. To
  35.  
  36. | Book Title Author |
  37. |☑ Harry Potter 2 J.k Rowling|
  38. |☑ Harry Potter 4 J.k Rowling|
  39. |☑ Harry Potter 6 J.k Rowling|
  40. |☑ Harry Potter 7 J.k Rowling|
  41. |☐ Harry Potter 1 J.k Rowling|
  42. |☐ Harry Potter 3 J.k Rowling|
  43. |☐ Harry Potter 5 J.k Rowling|
Add Comment
Please, Sign In to add comment