Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27034

VS 2010 Datagrid columns comparison problem

$
0
0
Hi,

datagrid trying to compare the two lines. I did, but I can not cross a kind of search. putting an image as an example. I'd appreciate it if you help.



The normal appearance of the grid number 1 in the picture. There is after pressing the button number 2 in the picture. here stems from the full question. in those marks. There should be the picture number 3 results. add your help.


Attachment 94197


Code:


Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim mylist As ArrayList = New ArrayList({New With {.A = 1, .B = 1}, _
                            New With {.A = 2, .B = 3}, _
                            New With {.A = 3, .B = 2}, _
                            New With {.A = 4, .B = 4}, _
                            New With {.A = 7, .B = 5}, _
                            New With {.A = 4, .B = 6}, _
                            New With {.A = 6, .B = 8}, _
                            New With {.A = 5, .B = 4}})

        DataGridView1.DataSource = mylist
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each row As DataGridViewRow In DataGridView1.Rows
            If CInt(row.Cells("A").Value) <> CInt(row.Cells("B").Value) Then
                row.DefaultCellStyle.BackColor = Color.Red
            End If
        Next
    End Sub
End Class

Attached Images
 

Viewing all articles
Browse latest Browse all 27034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>