Winforms - Iterate through the grid

 

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.")
        Me.RadGridView1.CancelEdit()
        Me.RadGridView1.MasterView.TableAddNewRow.CancelAddNewRow()
        Exit Sub
    End If
Next


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences