public void show_list_packing() { List <object[]> dtlot = new List <object[]>(); MainMenu flot = new MainMenu(); //dtlot = flot.get_data_listpacking_daysearlier(20); dtlot = flot.get_data_listpacking_daysearlier_fieldname(7, "case_number,grade,packingsize,intlotcode,best_before_date"); if (dtlot.Count > 0) { dataGridView1.Rows.Clear(); dataGridView1.Rows.Add(dtlot.Count); for (int i = 0; i < dtlot.Count; i++) { dataGridView1.Rows[i].Height = 50; dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString(); /* * dataGridView1.Rows[i].Cells[1].Value = dtlot[i][2].ToString(); * dataGridView1.Rows[i].Cells[2].Value = dtlot[i][3].ToString(); * dataGridView1.Rows[i].Cells[3].Value = dtlot[i][4].ToString(); * dataGridView1.Rows[i].Cells[4].Value = dtlot[i][5].ToString(); * DateTime dt = DateTime.Parse(dtlot[i][7].ToString()); * * if (!dt.ToString("yyyy-MM-dd").Equals("1900-01-01")) * { * dataGridView1.Rows[i].Cells[5].Value = dt.ToString("yyyy-MM-dd"); * } * else * { * dataGridView1.Rows[i].Cells[5].Value = ""; * } */ dataGridView1.Rows[i].Cells[1].Value = dtlot[i][0].ToString(); dataGridView1.Rows[i].Cells[2].Value = dtlot[i][1].ToString(); dataGridView1.Rows[i].Cells[3].Value = dtlot[i][2].ToString(); dataGridView1.Rows[i].Cells[4].Value = dtlot[i][3].ToString(); DateTime dt = DateTime.Parse(dtlot[i][4].ToString()); if (!dt.ToString("yyyy-MM-dd").Equals("1900-01-01")) { dataGridView1.Rows[i].Cells[5].Value = dt.ToString("yyyy-MM-dd"); } else { dataGridView1.Rows[i].Cells[5].Value = ""; } } Select_columnbutton(); } }