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 data in customer table from customer data grid view private void DGV_Customer_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { string value = DGV_Customer.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); this.Text = "Row : " + e.RowIndex.ToString() + " Col : " + e.ColumnIndex.ToString() + " Value = " + value; Obj_Data.CustomerID = Convert.ToInt32(DGV_Customer.Rows[e.RowIndex].Cells[0].Value); text_firstname.Text = DGV_Customer.Rows[e.RowIndex].Cells[1].Value.ToString(); text_lastname.Text = DGV_Customer.Rows[e.RowIndex].Cells[2].Value.ToString(); text_mobile.Text = DGV_Customer.Rows[e.RowIndex].Cells[4].Value.ToString(); text_address.Text = DGV_Customer.Rows[e.RowIndex].Cells[3].Value.ToString(); text_custName.Text = DGV_Customer.Rows[e.RowIndex].Cells[1].Value.ToString() + " " + DGV_Customer.Rows[e.RowIndex].Cells[2].Value.ToString(); } catch (Exception ex) { MessageBox.Show("Something is wrong", ex.Message); } Customer_panel.Show(); Rental_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(); }