Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to return to the top of a foreach loop
Message
 
À
22/01/2007 17:02:04
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01185290
Message ID:
01194307
Vues:
12
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform