Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.
int sum = 0;
foreach (DataRow rows in dt.Rows)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
int number = Convert.ToInt32(dt.Rows[j].Field<int>(i));
sum += number;
}
}
rows["testrow"] = sum;
}
dataGridView1.DataSource = dt;
}
foreach (DataRow rows in dt.Rows)
{
int sum_row = 0;
for (int i = 0; i < dt.Columns.Count ; i++)
{
int number = Convert.ToInt32(rows.Field<int>(i));
sum_row += number;
}
rows.Field( dt.Columns) = sum_row;
}
dataGridView1.DataSource = dt;
System.Data.DataTable dt = ds.Tables[0];
dt.Columns.Add("testrow", typeof(int));
DataRow dr = dt.NewRow();
int sum = 0;
for (int i = 1; i < dt.Columns.Count; i++)
{
for (int j = 1; j < dt.Rows.Count; j++)
{
if (j == dt.Rows.Count - 1)
{
dt.Rows[i][j] = Convert.ToInt32(sum);
sum = 0;
}
else
{
object number = dt.Rows[i][j];
sum += Convert.ToInt32(number);
}
}
dataGridView1.DataSource = dt;
}
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
VB.NET Textbox input validation | 4 | 66 | |
ASP.NET on IIS website not sending PDF file anymore ? [IzillaFramework Cognition] | 6 | 50 | |
ASP.NET Calendar Control | 5 | 25 | |
VB.net Filesystem watcher not working | 5 | 37 |
Join the community of 500,000 technology professionals and ask your questions.