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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Karthik ElumalaiRank #544 · 4.5K reputationPosted Jun 20, 2016, 6:34 PM EDT
antonio sanchez22 reputationPosted Jun 21, 2016, 8:45 AM EDT
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();
}
}