private void CustomerWithMoerVideo_Click(object sender, EventArgs e) { DGV_Rentals.DataSource = null; try { string queryObj = "Select * from CustomerWithMoreMovie"; DGV_Rentals.DataSource = obj_Database.FillDGV(queryObj); DGV_Rentals.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Btn_rentedOut_Click(object sender, EventArgs e) { //When click the button make it null DGV_Rentals.DataSource = null; try { // select the view form the database string queryObj = "Select * from ReturnOuts"; DGV_Rentals.DataSource = obj_Database.FillDGV(queryObj); // To resize the data grid view DGV_Rentals.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } catch (Exception ex) { MessageBox.Show(ex.Message); } }