|
값1 | 값2 | 값3 | 값4 | 평균값 |
1.번100을 입력과 동시에 | 2번.200을 입력 하면 |
1번.평균값이 실시간으루 100 2번.300/2 돼서 실시간입력 돼기 | ||
private void dataGrid_CurrentCellChanged(object sender, System.EventArgs e)
{
for (int i = 2; i < 14; i++)
{
ds.Tables["myDT"].Rows[dataGrid.CurrentRowIndex][i].ToString();
Hap();
}
private void Hap()
{
double total = 0;
int cnt = 0;
for (int i = 2; i < 14; i++)
{
string str = ds.Tables["myDT"].Rows[dataGrid.CurrentRowIndex][i].ToString();
if(str.Length > 0 )
{
cnt++;
total += double.Parse(str);
}
}
if(total==0||cnt==0)
{
ds.Tables["myDT"].Rows[dataGrid.CurrentRowIndex][14] ="";
}
else
{
ds.Tables["myDT"].Rows[dataGrid.CurrentRowIndex][14] =Math.Round((total/cnt),3);
}
}