Compare with another datagrid datagrid

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


    thanks
Parents
  • 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
    
Reply
  • 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
    
Children
No Data