I have a String Array that has 5000 Indexes. now I want to loop through them but only 1300 indexes at time until the end of string array how can I do this?
this is what I have so far
String [] MyArray= new string [5000]; // this is just and example in my program the length of my string is determined at runtime so I have no way of knowing how long the string array will be.
Now I want to loop through it something like this
first time around get Index [0] through [1299] seconds time around get Index [1300] through [2599] and so on until the end of array Index.
How can I do this.
here is my code
DataView fin = new DataView(ds.Tables["domestic"]);
DataView TempXml = new DataView(Xml);
DataTable OneOzXml = Xml.Clone();
int o = 0;
string[] smn = OneOunce.ToString().Split(' ');
int totalRecords= smn.Length-1;
for (int t = 0; t < smn.Length-1; t++)
{
fin.RowFilter = "Statementnumber=" + smn[t];
TempXml.RowFilter = "Statementnumber=" + smn[t];
for (int i = 0; i <= fin.Count - 1; i++)
{
OneOz.ImportRow(fin[i].Row);
}
for (int i = 0; i <= TempXml.Count-1 ; i++)
{
OneOzXml.ImportRow(TempXml[i].Row);
}
o++;
while (totalRecords!=0)
if (o == 1300)
{
int filenumber=1;
string Filename = "MArtin_1oz_" + filenumber;
XmlFilename = @"d:\XML\" + Filename + ".xml";
System.IO.FileStream streamWrite = new System.IO.FileStream(XmlFilename, System.IO.FileMode.Create);
OneOzXml.WriteXml(streamWrite);
streamWrite.Close();
XElement xEle = XElement.Load(@"d:\XML\" + Filename + ".xml");
var snumber = xEle.Elements("MetaDataDetail").Elements("STATEMENTNUMBER").ToList();
foreach (XElement Statementnumber in snumber)
Statementnumber.Remove();
xEle.Save(@"d:\XML\"+Filename+".xml");
reportDoc.SetDataSource(OneOz);
CrDiskFileDestinationOptions.DiskFileName = @"D:\pdf\"+Filename+".pdf";
reportDoc.Export();
OneOz.Clear();
OneOzXml.Clear();
PdfDocument AddCustomerPackage = new PdfDocument();
AddCustomerPackage = PdfReader.Open(@"D:\pdf\" + Filename + ".pdf", PdfDocumentOpenMode.Modify);
ffp WritePackageNumber = new ffp();
WritePackageNumber.FindFirstPage(AddCustomerPackage, "Page 1");
filenumber++;
//int pageCount = 1;
//int counter = document.PageCount;
//PdfSharp.Pdf.PdfPage Pages;
//for (int idx = 0; idx < counter; idx++)
//{
// Pages = document.Pages[idx];
// gfx = XGraphics.FromPdfPage(Pages);
// gfx.DrawString(pageCount.ToString("00000"), font, XBrushes.Black,
// new XRect(246, 140, Pages.Width, Pages.Height),
// XStringFormats.TopLeft);
// pageCount++;
//}
//document.Save(document.FullPath);
totalRecords = totalRecords - o;
o = 0;
for-loop
can help you accomplish this. – Tdorno May 31 at 13:18