private void button1_Click(object sender, EventArgs e)
{
if (this.gridGroupingControl1.Table.CurrentRecord != null)
{
this.gridGroupingControl1.Table.CurrentRecord.Delete();
}
else
{
if (this.gridGroupingControl1.Table.Records.Count > 0) // check with this condition
this.gridGroupingControl1.Table.Records[0].Delete();
}
}
if (this.gridGroupingControl1.Table.CurrentRecord != null && this.gridGroupingControl1.Table.CurrentRecord != this.gridGroupingControl1.Table.AddNewRecord)
{
this.gridGroupingControl1.Table.CurrentRecord.Delete();
}
hi..
the problem here is when zeroth record is reached the table still has the value i.e
grdDisplayItems.Table.CurrentRecord != null condition is satisfied and
this.grdDisplayItems.Table.CurrentRecord.Delete(); is executed because of which whole application terminates and i get the exception.
if (this.gridGroupingControl1.Table.CurrentRecord != null && this.gridGroupingControl1.Table.Records.Count > 0)
{ this.gridGroupingControl1.Table.CurrentRecord.Delete(); } |