public void loadpackingdetails(String pl) { List <object[]> data1 = new List <object[]>(); MainMenu frm = new MainMenu(); data1 = frm.get_data_netweight_packing(pl); double netweight = double.Parse(data1[0][0].ToString()); List <object[]> data = new List <object[]>(); //data=frm.get_data_table_string("tbpacking","shipping_unit_number",pl); data = frm.get_data_table_packing_datetime_desc_fieldname(pl, "case_number,grade,packingsize,intlotcode,pieces,boxweight,remark"); Int32 pieces = 0; dataGridView1.Visible = false; dataGridView1.Visible = true; dataGridView1.Rows.Clear(); if (data.Count > 0) { pieces = data.Count; dataGridView1.Rows.Add(data.Count); for (int i = 0; i < data.Count; i++) { dataGridView1.Rows[i].Height = 50; /* * dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString(); * dataGridView1.Rows[i].Cells[1].Value = data[i][2].ToString(); * dataGridView1.Rows[i].Cells[2].Value = data[i][3].ToString(); * dataGridView1.Rows[i].Cells[3].Value = data[i][4].ToString(); * dataGridView1.Rows[i].Cells[4].Value = data[i][5].ToString(); * dataGridView1.Rows[i].Cells[5].Value = data[i][8].ToString(); * dataGridView1.Rows[i].Cells[6].Value = data[i][11].ToString(); * dataGridView1.Rows[i].Cells[7].Value = data[i][16].ToString(); * netweight = netweight + double.Parse(data[i][11].ToString()); */ dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString(); dataGridView1.Rows[i].Cells[1].Value = data[i][0].ToString(); dataGridView1.Rows[i].Cells[2].Value = data[i][1].ToString(); dataGridView1.Rows[i].Cells[3].Value = data[i][2].ToString(); dataGridView1.Rows[i].Cells[4].Value = data[i][3].ToString(); dataGridView1.Rows[i].Cells[5].Value = data[i][4].ToString(); dataGridView1.Rows[i].Cells[6].Value = data[i][5].ToString(); dataGridView1.Rows[i].Cells[7].Value = data[i][6].ToString(); //netweight = netweight + double.Parse(data[i][5].ToString()); } } Delete_columnbutton(); Int32 totalpcs = pieces; lblbox.Text = totalpcs.ToString(); lblnweight1.Text = netweight.ToString(); }