anil john

anil john

  • NA
  • 156
  • 210k

Getting an error after adding two rows

Aug 24 2012 8:11 AM
Now am listing all my forms name in a gridview, but am getting an error  after adding two rows "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"
Can yo plz pls help me to solve this problem

my code:
 dgPreveleges.Rows.Add();
  dgPreveleges.Rows[0].Cells[0].Value = "Balance";
  dgPreveleges.Rows[1].Cells[0].Value = "BankofAccounts";
  dgPreveleges.Rows[2].Cells[0].Value = "EmployeeMaster";
  dgPreveleges.Rows[3].Cells[0].Value = "frmAddUser";
  dgPreveleges.Rows[4].Cells[0].Value = "frmBranchMaster";
  dgPreveleges.Rows[5].Cells[0].Value = "frmChittyAuction";
  dgPreveleges.Rows[6].Cells[0].Value = "frmChittyGeneralReciept";
  dgPreveleges.Rows[7].Cells[0].Value = "frmChittyInstallments";
  dgPreveleges.Rows[8].Cells[0].Value = "frmChittyMaster";
  dgPreveleges.Rows[9].Cells[0].Value = "frmChittyPayments";
  dgPreveleges.Rows[10].Cells[0].Value = "frmChittyReciepts";
  dgPreveleges.Rows[11].Cells[0].Value = "frmChittyRegistration.";
  dgPreveleges.Rows[12].Cells[0].Value = "frmChittyReport";
  dgPreveleges.Rows[13].Cells[0].Value = "frmCompanyMaster";
  dgPreveleges.Rows[14].Cells[0].Value = "frmContra";
  dgPreveleges.Rows[15].Cells[0].Value = "frmCustomerLedger";
  dgPreveleges.Rows[16].Cells[0].Value = "frmCustomerMaster";
  dgPreveleges.Rows[17].Cells[0].Value = "frmDueList";
  dgPreveleges.Rows[18].Cells[0].Value = "frmGeneralPayments";
  dgPreveleges.Rows[19].Cells[0].Value = "frmGeneralReciept";
  dgPreveleges.Rows[20].Cells[0].Value = "frmInstallmentCreation";
  dgPreveleges.Rows[21].Cells[0].Value = "frmJournelEntry";
  dgPreveleges.Rows[22].Cells[0].Value = "frmLogin";
  dgPreveleges.Rows[23].Cells[0].Value = "frmMAGNA";
  dgPreveleges.Rows[24].Cells[0].Value = "frmMAGNA_BRANCH";
  dgPreveleges.Rows[25].Cells[0].Value = "frmPaymentDetails";
  dgPreveleges.Rows[26].Cells[0].Value = "frmPrintBalanceSheet";
  dgPreveleges.Rows[27].Cells[0].Value = "frmPrintBankAcc";
  dgPreveleges.Rows[28].Cells[0].Value = "frmPrintPandL";
  dgPreveleges.Rows[29].Cells[0].Value = "frmPrintTrailBalance";
  dgPreveleges.Rows[30].Cells[0].Value = "frmReportAccountLedger";
  dgPreveleges.Rows[31].Cells[0].Value = "frmUserPrevilege";
  dgPreveleges.Rows[32].Cells[0].Value = "frmVoucherConfiguration";
  dgPreveleges.Rows[33].Cells[0].Value = "frmVoucherListView";
  dgPreveleges.Rows[34].Cells[0].Value = "frmxGeneralReciept"

Answers (1)