public Video_Rental() { InitializeComponent(); customer_datagridview(); Movies_dataLoad(); Rental_dataLoad(); Goodcustomer_load(); Goodmovie_load(); Customer_panel.Hide(); Rental_panel.Hide(); Movie_panel.Hide(); }
//code to select rentel detail from data grid view private void DGV_Rental_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { string value = DGV_Rental.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); this.Text = "Row : " + e.RowIndex.ToString() + " Col : " + e.ColumnIndex.ToString() + " Value = " + value; Obj_Data.Rental_ID = Convert.ToInt32(DGV_Rental.Rows[e.RowIndex].Cells[8].Value); text_custName.Text = DGV_Rental.Rows[e.RowIndex].Cells[0].Value.ToString() + " " + DGV_Rental.Rows[e.RowIndex].Cells[1].Value.ToString(); text_TitleM.Text = DGV_Rental.Rows[e.RowIndex].Cells[3].Value.ToString(); issue_datePicker.Text = DGV_Rental.Rows[e.RowIndex].Cells[6].Value.ToString(); } catch (Exception ex) { MessageBox.Show("Something is wrong", ex.Message); } Rental_panel.Show(); Customer_panel.Hide(); Movie_panel.Hide(); }
//code to add movie data in movies table from movies data grid private void DGV_Movie_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { string value = DGV_movie.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); this.Text = "Row : " + e.RowIndex.ToString() + " Col : " + e.ColumnIndex.ToString() + " Value = " + value; Obj_Data.MoviesID = Convert.ToInt32(DGV_movie.Rows[e.RowIndex].Cells[0].Value); text_Rating.Text = DGV_movie.Rows[e.RowIndex].Cells[1].Value.ToString(); text_Title.Text = DGV_movie.Rows[e.RowIndex].Cells[2].Value.ToString(); text_year.Text = DGV_movie.Rows[e.RowIndex].Cells[3].Value.ToString(); Text_Rental_Cost.Text = DGV_movie.Rows[e.RowIndex].Cells[4].Value.ToString(); text_copies.Text = DGV_movie.Rows[e.RowIndex].Cells[5].Value.ToString(); text_plot.Text = DGV_movie.Rows[e.RowIndex].Cells[6].Value.ToString(); text_genre.Text = DGV_movie.Rows[e.RowIndex].Cells[7].Value.ToString(); text_TitleM.Text = DGV_movie.Rows[e.RowIndex].Cells[2].Value.ToString(); } catch (Exception ex) { MessageBox.Show("Something is wrong", ex.Message); } Movie_panel.Show(); Rental_panel.Hide(); Customer_panel.Hide(); }