Out of Index Error Can someone point me in the right direction to fix this error?

  • Thread starter Thread starter Si2323
  • Start date Start date
S

Si2323

Guest
Problem getting Account Master Header Data

Source:mscorlib

Description: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name:index

Stack Trace: at System.Collection.ArrayList.get_Item(Int32 index) at System.Windows.Forms.DataGrid.ViewRowCollection.SharedRow(Int32rowIndex)

at System.Windows.Forms.DataGridViewRowCollection.get_Item(Int32 index)

at PgMgmt.frmMain.OnLoad(EventArgs e)




code

// Load AccountMaster Header Data
try
{
var accountMastersBindingList = new BindingList<AccountMaster>(_accountMasters);
this.AccountMastersBindingSource.DataSource = accountMastersBindingList;
accountMasterDataGridView.DataSource = this.AccountMastersBindingSource;

accountMasterDataGridView.Rows[0].Selected = true;
DataGridViewRow rowAccountMaster = accountMasterDataGridView.SelectedRows[0];

LoadGroups();

groupMastersDataGridView.Rows[0].Selected = true;
DataGridViewRow rowGroupMaster = groupMastersDataGridView.SelectedRows[0];

String groupMasterID = rowGroupMaster.Cells[0].Value.ToString();

LoadCoverages();

}
catch (Exception ex)
{
MessageBox.Show("Problem getting Account Master Header Data\r\n" + "Source: " + ex.Source + "\r\n" + "Description: " + ex.Message + "\r\n" + "Stack Trace: " + ex.StackTrace);
}

Continue reading...
 
Back
Top