-1
버튼의 dataGridView 열에 저장된 정수 및 부동 소수점 값의 합계를 계산하고 텍스트 상자에 프로그램을 저장할 수 있습니까?어떻게 합계를 계산할 수 있습니까? DataGridView 열의 값 중 하나입니까?
버튼의 dataGridView 열에 저장된 정수 및 부동 소수점 값의 합계를 계산하고 텍스트 상자에 프로그램을 저장할 수 있습니까?어떻게 합계를 계산할 수 있습니까? DataGridView 열의 값 중 하나입니까?
int sum = 0;
foreach (DataGridViewRow row in dataGridView.Rows)
{
//here 0 is the index of columns you want to get values from
// you can also use column name instead of index
sum += (int) row.Cells[0].Value;
}
//for showing the user message box
MessageBox.Show("Sum of all the values is {0}", sum.ToString());