I need to add the amounts of my column AMOUNTS and can see on a label, I use datagrid in C # for mobile smart device
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
antonio sanchezPosted Jun 21, 2016, 12:45 PM
and the second row is the same data
example
row 1
1q
1q
1q
row 2
fifty
fifty
my result
I have something
private void button2_Click(object sender, EventArgs e){
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2] {
new DataColumn("Raid", typeof(string)),
new DataColumn("Cantidad", typeof(int)) });
dt.Rows.Add("Raid");
dt.Rows.Add("Cantidad");
int total = 0;
foreach (DataRow row in dt.Rows) // Loop over the rows.
{
}
LABELTOTAL.Text = total.ToString();
// dt.Rows.Add("Cantidad");
LABELTOTAL.Text = Convert.ToString(dt.Compute("SUM(Cantidad)", ""));
if (LABELTOTAL.Text == TXTCANTIDADMASTER.Text)
{
MessageBox.Show("ES CORRECTO");
}
else
{
MessageBox.Show("ES INCORRECTO");
CODIGODEDESBLOQUEO frm = new CODIGODEDESBLOQUEO();
frm.Show();
}
}
Karthik ElumalaiPosted Jun 20, 2016, 10:34 PM