int count = 0; int count = 0; while (CurrentRecord < RecordsPerPage && count < itemgridview.Rows.Count) { //foreach (DataGridViewRow row in itemgridview.Rows ) //{ DataGridViewRow row = itemgridview.Rows[count]; FieldValue = row.Cells[0].Value.ToString(); // FieldValue = itemgridview.Rows["items"].ToString(); g.DrawString(FieldValue, InvoiceFont, BlackBrush, xItems, CurrentY); //FieldValue = dr["itmqty"].ToString(); FieldValue = row.Cells[1].Value.ToString(); // if Length of (Product Name) > 20, Draw 20 character only if (FieldValue.Length > 20) FieldValue = FieldValue.Remove(20, FieldValue.Length - 20); g.DrawString(FieldValue, InvoiceFont, BlackBrush, xQty, CurrentY); //FieldValue = String.Format(dr["itemprice"].ToString()); FieldValue = row.Cells[2].Value.ToString(); g.DrawString(FieldValue, InvoiceFont, BlackBrush, xPrice, CurrentY); //FieldValue = dr["subtotal"].ToString(); FieldValue = row.Cells[3].Value.ToString(); g.DrawString(FieldValue, InvoiceFont, BlackBrush, xSubTotal, CurrentY); CurrentY = CurrentY + InvoiceFontHeight; CurrentRecord++; count++; } if (count>0 ) { // StopReading = true; SetInvoiceTotal(g); } g.Dispose(); }
while
CurrentRecord
RecordsPerPage
if
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)