private void addbill_Click(object sender, EventArgs e) { foreach (DataGridViewRow item in dataGridView1.Rows) { if (Convert.ToBoolean(item.Cells[0].Value) == true) { int n = dataGridView2.Rows.Add(); dataGridView2.Rows[n].Cells[0].Value = item.Cells[1].Value.ToString(); dataGridView2.Rows[n].Cells[1].Value = item.Cells[2].Value.ToString(); dataGridView2.Rows[n].Cells[2].Value = item.Cells[3].Value.ToString(); } } dataGridView1.DataSource = null; dataGridView1.DataSource = FOODBUS.GETFOOD(); }
private void admin_Load(object sender, EventArgs e) { dataBill.DataSource = BILLBUS.GETBILL(); dataFood.DataSource = FOODBUS.GETFOOD(); dataDesk.DataSource = DESKBUS.GETDESK(); dataEmployer.DataSource = EMPLOYERBUS.GETEMPLOYER(); dataSpecies.DataSource = SPECIESBUS.GETSPECIES(); desk_cbo.DataSource = DESKBUS.GETDESK(); desk_cbo.ValueMember = "IDDESK"; desk_cbo.DisplayMember = "NAMEDESK"; speciescbo.DataSource = SPECIESBUS.GETSPECIES(); speciescbo.ValueMember = "IDSPECIES"; speciescbo.DisplayMember = "NAMESPECIES"; }
public void showdatagridview() { /* DataTable dt = new DataTable(FOODBUS.GETFOOD().ToString()); * dataGridView1.Rows.Clear(); * foreach (DataRow item in dt.Rows) * { * int n = dataGridView1.Rows.Add(); * dataGridView1.Rows[n].Cells[0].Value = false; * dataGridView1.Rows[n].Cells[1].Value = item["ID"].ToString(); * dataGridView1.Rows[n].Cells[2].Value = item["NAMEFOOD"].ToString(); * dataGridView1.Rows[n].Cells[3].Value = item["SPICE"].ToString(); * }*/ dataGridView1.DataSource = FOODBUS.GETFOOD(); dataGridView1.RowHeadersVisible = false; dataGridView2.RowHeadersVisible = false; this.dataGridView1.DefaultCellStyle.Font = new Font("Times New Roman", 15); this.dataGridView2.DefaultCellStyle.Font = new Font("Times New Roman", 15); }
private void tabPage1_Click(object sender, EventArgs e) { dataFood.DataSource = FOODBUS.GETFOOD(); }