Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to return to the top of a foreach loop
Message
 
To
22/01/2007 17:02:04
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185290
Message ID:
01194307
Views:
13
John,

Between the flu and other projects, I haven't gotten back to this. Here's the code.
foreach (InvoiceEntity Invoice in InvEntityList)
   {
        // Initialize variables for determining charges
	...

	
       // Make sure there is a valid service master code for this cyinvoice
       entServiceMaster = oServiceMaster.GetServiceMasterByStoreAndInvclass(Invoice.storeno, invoice.invclass);
       if (entServiceMaster.HasValues.Equals(false))
          {
             // Skip this record because critical information is missing.
             string ErrorMessage;
             if (mmAppBase.Localize)
                ErrorMessage = mmAppBase.MessageMgr.GetMessage("No Service Master record.");
             else
                ErrorMessage = "No Service Master record.";
                Invoice.errstatus = ErrorMessage;
                this.DataSet.AcceptChanges();
                CurrentInvoice = Invoice.cyinvoice;
                continue;
          }

	//Record is good so write lines to text file
        ...
   }
The way I got it to work was by moving all the code inside the foreach loop to a separate method but I'd really like to use the continue option, at least in the future.

Thanks for your help.

Linda
Linda Harmes
HiBit Technologies, Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform