sgray128 8/26/2014 3:43:03 PM

Winforms - Iterate through the grid

Code to iterate through a RadGridView                       


For Each oRow As GridViewRowInfo In Me.RadGridView1.MasterView.Rows
    'get existing item number value
    Dim strItemNumber As String = oRow.Cells("vchrItemNumberGP").Value
    Dim intMasterOrderItemFK As Int32 = oRow.Cells("intMasterOrderItemFK").Value
    'if an existing item number value is found that is equal to the new value, then msgbox warning and exit sub
    If intMasterOrderItemFK = Me.RadGridView1.MasterView.TableAddNewRow.Cells("intMasterOrderItemFK").Value Then
        MsgBox("Item already exists in this Suborder.")
        Exit Sub
    End If