Skip to main content
  1. hello ,
    
    I wonder if it is possible comparisons between datagridview 


    thanks
  1. hello ,
    
    I wonder if it is possible comparisons between datagridview 


    thanks

I am not sure what you are asking for. In the post that was e-mailed to me there was some example code in vb but it does not appear in this post.

Did you want the vb code converted to COBOL or were you asking for something else?

The code shows as:

6.	Private Sub DataGridView1_SortCompare( _
7.	
8.	    ByVal sender As Object, ByVal e As DataGridViewSortCompareEventArgs) _
9.	
10.	    Handles DataGridView1.SortCompare
11.	
12.	
13.	
14.	    ' Try to sort based on the contents of the cell in the current column.
15.	
16.	    e.SortResult = System.String.Compare(e.CellValue1.ToString(), _
17.	
18.	        e.CellValue2.ToString())
19.	
20.	
21.	
22.	    ' If the cells are equal, sort based on the ID column.
23.	
24.	    If (e.SortResult = 0) AndAlso Not (e.Column.Name = "ID") Then
25.	
26.	        e.SortResult = System.String.Compare( _
27.	
28.	            DataGridView1.Rows(e.RowIndex1).Cells("ID").Value.ToString(), _
29.	
30.	            DataGridView1.Rows(e.RowIndex2).Cells("ID").Value.ToString())
31.	
32.	    End If
33.	
34.	
35.	
36.	    e.Handled = True
37.	
38.	
39.	
End Sub

  1. hello ,
    
    I wonder if it is possible comparisons between datagridview 


    thanks

sorry , I sent the wrong code, but need to make a comparison between two datagridview and bring the differences between the two


  1. hello ,
    
    I wonder if it is possible comparisons between datagridview 


    thanks

What are you actually comparing between the two grids, a 1 to 1 comparison by cell, so comparing grid1 row 1 col 1 with grid2 row 1 col 1, grid1 row 1 col2 with grid2 row 1 col2, etc.? Are you using data binding to a List, collection  or Dataset, etc?

How do you want the differences returned?