Once a row matches an invoice number I want the for each loop to stop. How do I stop the loop?
private void gridInvoiceEntryGrid_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs args)
{
UltraGridRow activeRow = gridInvoiceEntryGrid.ActiveRow;
neInvoiceNumberfromMemos.Value = activeRow.Cells["InvcHead_InvoiceNum"].Value.ToString();
foreach (UltraGridRow row in this.grdList.Rows.GetRowEnumerator(GridRowType.DataRow, null, null))
{
if (Int32.Parse(row.GetCellValue("InvoiceNum").ToString()) == Int32.Parse(neInvoiceNumberfromMemos.Value.ToString()))
{
MessageBox.Show("Invoice Number matches");
row.Selected = true;
row.Activated = true;
gridCustomerNotes.Focus();
//STOP FOR EACH LOOP HERE
}
else
{
MessageBox.Show("Invoice Number doesn't match");
}
}
}