summing columns error

Oct 24 2010 12:59 PM

when i use this code vs shows following error : Specified cast is not valid. with title : InvalidCastExeption was unhandled

what is incorrect i think it must be work very good. cant find any mistake

  private void TradeLog_Load_1(object sender, EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11);
decimal allwin;
decimal win = 0;
decimal self;

for (int i = 0; i < DgvLog.Rows.Count; i++)
{
self = (decimal)DgvLog.Rows[i].Cells["selfPriceDataGridViewTextBoxColumn"].Value;
win += self;
}

allwin = sum - win;
label7.Text = win.ToString();
}


Answers (5)