日期:2014-05-18 浏览次数:21226 次
private void UpdateBalance()
{
int i;
int account;
int qty;
int price;
for (i = 1; i < (CGVIEW.Rows.Count - 1);i++)
{
qty = 0;
price = 0;
account = int.Parse(CGVIEW.Rows[i - 1].Cells["ACCOUNT"].Value.ToString());
if (CGVIEW.Rows[i].Cells["QTY"].Value != null)
{
if (CGVIEW.Rows[i].Cells["QTY"].Value.ToString().Length != 0)
{
qty = int.Parse(CGVIEW.Rows[i].Cells["QTY"].Value.ToString());
}
}
if (CGVIEW.Rows[i].Cells["PRICE"].Value != null)
{
if (CGVIEW.Rows[i].Cells["PRICE"].Value.ToString().Length != 0)
{
price = int.Parse(CGVIEW.Rows[i].Cells["PRICE"].Value.ToString());
}
}
CGVIEW.Rows[i].Cells["ACCOUNT"].Value =(qty*price).ToString();
}
}
private void CGVIEW_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
UpdateBalance();
}