{ int i; double text1 = 0; double text2 = 0; double text3 = 0; double text4 = 0; double text5 = 0; for (i = 0; i <= dataGridView1.Rows.Count - 1; i++) { text1 = text1 + Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value); text2 = text2 + Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value); text3 = text3 + Convert.ToDouble(dataGridView1.Rows[i].Cells[9].Value); text4 = text4 + Convert.ToDouble(dataGridView1.Rows[i].Cells[10].Value); text5 = text5 + Convert.ToDouble(dataGridView1.Rows[i].Cells[11].Value); } label4.Text = text1.ToString(); label5.Text = text2.ToString(); label6.Text = text3.ToString(); label7.Text = text4.ToString(); label8.Text = text5.ToString(); }
FormatNumber(text2,2)
label5.Text = FormatNumber(text2,2)
private void Calculatetext1() { int i; double text1 = 0; double text2 = 0; double text3 = 0; double text4 = 0; double text5 = 0; for (i = 0; i <= dataGridView1.Rows.Count - 1; i++) { text1 = text1 + Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value); text2 = text2 + Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value); text3 = text3 + Convert.ToDouble(dataGridView1.Rows[i].Cells[9].Value); text4 = text4 + Convert.ToDouble(dataGridView1.Rows[i].Cells[10].Value); text5 = text5 + Convert.ToDouble(dataGridView1.Rows[i].Cells[11].Value); } label4.Text = text1.ToString(); label5.Text = FormatNumber(text2,2) label6.Text = text3.ToString(); label7.Text = text4.ToString(); label8.Text = text5.ToString(); }
label5.Text =text2.ToString("00.00");
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง