Question
Using the C # programming language in Visual Studio creating a Windows Form App (.Net Framework) I made the app of a movie collection. I
Using the C # programming language in Visual Studio creating a Windows Form App (.Net Framework) I made the app of a movie collection. I need help with the summary button so it shows in a MsgBox with the information of the number of movies, the total cost and the average price. How should I write the Summary Button code ? This is what I got :
Form 1 CODE :
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace MovieCollection_BrianFebles { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void dVDcollectionBindingNavigatorSaveItem_Click(object sender, EventArgs e) //Binding Navigator Save Item { this.Validate(); this.dVDcollectionBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.dVDCollectionDataSet);
}
private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dVDCollectionDataSet.DVDcollection' table. You can move, or remove it, as needed. this.dVDcollectionTableAdapter.Fill(this.dVDCollectionDataSet.DVDcollection);
}
private void dVDcollectionDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) {
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) // Queries { switch (QueriesComboBox.SelectedIndex) { case 0: dVDcollectionTableAdapter.Fill(this.dVDCollectionDataSet.DVDcollection); break; case 1: dVDcollectionTableAdapter.FillByAccionOrAction(this.dVDCollectionDataSet.DVDcollection); break; case 2: dVDcollectionTableAdapter.FillByAdventure(this.dVDCollectionDataSet.DVDcollection); break; case 3: dVDcollectionTableAdapter.FillByAnimation(this.dVDCollectionDataSet.DVDcollection); break; case 4: dVDcollectionTableAdapter.FillByComedy(this.dVDCollectionDataSet.DVDcollection); break; case 5: dVDcollectionTableAdapter.FillByCrime(this.dVDCollectionDataSet.DVDcollection); break; case 6: dVDcollectionTableAdapter.FillByDrama(this.dVDCollectionDataSet.DVDcollection); break; case 7: dVDcollectionTableAdapter.FillByHistorical(this.dVDCollectionDataSet.DVDcollection); break; case 8: dVDcollectionTableAdapter.FillByHorror(this.dVDCollectionDataSet.DVDcollection); break; case 9: dVDcollectionTableAdapter.FillBySciFi(this.dVDCollectionDataSet.DVDcollection); break; case 10: dVDcollectionTableAdapter.FillByDescendingPrice(this.dVDCollectionDataSet.DVDcollection); break; case 11: dVDcollectionTableAdapter.FillByAfterYear2000(this.dVDCollectionDataSet.DVDcollection); break; case 12: dVDcollectionTableAdapter.FillByBTitle(this.dVDCollectionDataSet.DVDcollection); break; case 13: dVDcollectionTableAdapter.FillByDurationOf2HoursOrMoreAndPriceLess15Dollars(this.dVDCollectionDataSet.DVDcollection); break; case 14: dVDcollectionTableAdapter.FillByYear2000OrBefore(this.dVDCollectionDataSet.DVDcollection); break;
}//end switch }//end private void
private void button2_Click(object sender, EventArgs e) //Refresh Button { this.dVDcollectionTableAdapter.Fill(this.dVDCollectionDataSet.DVDcollection); QueriesComboBox.SelectedIndex = 0; }
private void button3_Click(object sender, EventArgs e) // Edit Button { Form editForm = new EditorForm(); editForm.Show(); }
private void button4_Click(object sender, EventArgs e) //Exit Button { this.Close(); //Exits The Form }
private void button1_Click(object sender, EventArgs e) //SummaryButton {
} } }
The Form 1 for the movies
QUERIES I MADE :
EDITOR FORM
CODE FOR EDITOR FORM :
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace MovieCollection_BrianFebles { public partial class EditorForm : Form { public EditorForm() { InitializeComponent(); }
private void dVDcollectionBindingNavigatorSaveItem_Click(object sender, EventArgs e) { try { this.Validate(); this.dVDcollectionBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.dVDCollectionDataSet); MessageBox.Show("Actualizando correctamente la base de datos"); } catch (System.Exception ex) { System.Exception ex1 = ex; MessageBox.Show("Error: No se pudo actualizar"); } }
private void EditorForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dVDCollectionDataSet.DVDcollection' table. You can move, or remove it, as needed. this.dVDcollectionTableAdapter.Fill(this.dVDCollectionDataSet.DVDcollection);
}
private void button2_Click(object sender, EventArgs e) //browse all movies { this.dVDcollectionTableAdapter.Fill(this.dVDCollectionDataSet.DVDcollection);this.FindTextBox.Clear(); }
private void button1_Click(object sender, EventArgs e) //Boton de Find { this.dVDcollectionTableAdapter.FillByProductor(this.dVDCollectionDataSet.DVDcollection, this.FindTextBox.Text); }
private void FindTextBox_TextChanged(object sender, EventArgs e) //TextBox Button {
} } }
ID Pelicula Genero Productor Year Duracion Precio Protagonistas Fields Select Queries Summary Refresh Edit Exit DVDcollection PID Pelicula Genero Productor Year Duracion Precio Protagonistas Field8 DVD collection TableAdapter SQL Fill, GetData SQL AverageQuery 0 SQL FillByAccion OrAction, GetDataByAccionOrAction 0 SQL FillByAdventure, GetDataByAdventure SQL FillByAfterYear2000, GetDataByAfterYear20000 SQL FillByAnimation, GetDataByAnimation SQL FillByBTitle, GetDataByBTitle SQL FillByComedy, GetDataByComedy 0 SQL FillByCrime, GetDataByCrime SQL FillByDescending Price, GetDataByDescending Price SQL FillByDrama, GetDataByDrama 0 SQL FillByDuration Of2HoursOrMoreAndPriceless15Dollars, GetDataByDuration Of2HoursOrMoreAndPriceless15Dollars 0 SQL FillBy Historical, GetDataByHistorical SQL FillByHorror, GetDataByHorror 0 SQL FillByProductor, GetDataByProductor (Productor) SQL FillBySciFi, GetDataBySciFi 0 SQL Fill By Year20000rBefore, GetDataByYear20000rBefore 0 SQL TotalCostQuery O SQL TotalPeliculasQuery 0 X EditorForm K0 of {0} + XP ID: Pelicula: Genero: Productor: Year: Duracion: Precio: Protagonistas: Fields: Find movies by director Director Find Browse All Movies ID Pelicula Genero Productor Year Duracion Precio Protagonistas Fields Select Queries Summary Refresh Edit Exit DVDcollection PID Pelicula Genero Productor Year Duracion Precio Protagonistas Field8 DVD collection TableAdapter SQL Fill, GetData SQL AverageQuery 0 SQL FillByAccion OrAction, GetDataByAccionOrAction 0 SQL FillByAdventure, GetDataByAdventure SQL FillByAfterYear2000, GetDataByAfterYear20000 SQL FillByAnimation, GetDataByAnimation SQL FillByBTitle, GetDataByBTitle SQL FillByComedy, GetDataByComedy 0 SQL FillByCrime, GetDataByCrime SQL FillByDescending Price, GetDataByDescending Price SQL FillByDrama, GetDataByDrama 0 SQL FillByDuration Of2HoursOrMoreAndPriceless15Dollars, GetDataByDuration Of2HoursOrMoreAndPriceless15Dollars 0 SQL FillBy Historical, GetDataByHistorical SQL FillByHorror, GetDataByHorror 0 SQL FillByProductor, GetDataByProductor (Productor) SQL FillBySciFi, GetDataBySciFi 0 SQL Fill By Year20000rBefore, GetDataByYear20000rBefore 0 SQL TotalCostQuery O SQL TotalPeliculasQuery 0 X EditorForm K0 of {0} + XP ID: Pelicula: Genero: Productor: Year: Duracion: Precio: Protagonistas: Fields: Find movies by director Director Find Browse All MoviesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started