You are starting your own video store. I will place a modified copy of the database identified in the Case Study Video Bonanza for Chapter 10 on D2L. This modified database will include 2 additional tables for handling customer contact information and customer video orders.
Your project is to build an application to update this database. Your application should provide the capabilities to display and update the information in the Customer Table. You should also provide the ability to display all customer rentals if the user chooses, and to allow the user to check out a video to a customer. In addition, you will utilize a DataGrid to display the information in the Studio and Video tables. For this project you can assume that you have an unlimited quantity of each video on hand so you don’t have to worry about a video being out of stock if the customer wants to check it out.
You should have at a minimum 7 forms:
1. Main Form – Processes Customers
2. Check Out a video to a Customer
3. Display the videos a selected customer has rented
4. Display a list of all the videos in your store
5. Display a list of the studios that videos are obtained from
6. About Box
7. Splash Screen.
An example of each of these forms is provided on the pages below.
Each of your forms should contain a menu system to allow the other forms to be opened. The menu options are outlined below:
Window Display Studio, Display Video
The purpose of this form is to allow the user to add, change, delete, and inquire on Customers.
A binding navigator will allow the user to browse through the current records. The navigator also provides a new record button, delete button, and save button for modifying the records.
The Check Out button should open the Check Out Form to allow the user to add a new video checkout record to the database. The Rentals button should open the Rentals form to display all previous videos that the selected customer has rented.
Display Studio Form
This form uses a Datagrid control to display the data from the Studios table to the user. You can delete the Binding Navigator that Visual Studio will add to the form.
Remember to create separate Data Sources in your project.
Display Video Form
This form uses a Datagrid control to display the data from the Videos table to the user. You can delete the Binding Navigator that Visual Studio will add to the form.
Remember to create separate Data Sources in your project.
About Box Form
Check Out Form
This form will allow the user to check out a new video to a customer. The Customer ID and Name are displayed based on the current selected user on the Main Form. The customer name is concatenated from the textboxes on the Main Form. This is similar to the process you would have used for the Summary form when you completed your Chapter 6 homework.
The Check Out button will add a new record to the CustomerRental table in the database. The code necessary to add this record is shown below. Remember that you will need to add the CustomerRental Dataset to the form to have access to it in code but we don’t need it visually represented on the form so you can delete the DataGrid after adding the DataSet.
Code to create new Video Rental:
'Declare Variable for Inserting Row
Dim newrow As DataRow = CustomerRentalDataSet.CustomerRental.NewRow
'Move data to new row
newrow("CustomerID") = Integer.Parse(CustomerIDLabel.Text)
newrow("MovieNumber") = TitleListBox.SelectedValue.ToString
newrow("Date") = DateTime.Now
'Add the row
'Send changes to database
Me.CustomerRentalBindingSource.EndEdit() Me.CustomerRentalTableAdapter.Update(Me.CustomerRentalDataSet.CustomerRental) MessageBox.Show(“Record Added”, “Record Added", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Error Adding Record", "Customer", MessageBoxButtons.OK, MessageBoxIcon.Error)
The form also makes use of a listbox to display the available movie titles to the user for checkout. You can use the same DataSource you created for the Display Video form for the listbox.
Listboxes and Comboboxes use complex data binding as opposed to simple binding that a textbox or label uses.
Several properties associated with complex binding:
1. DataSource – set to the datasource we want to use to retrieve data.
2. Display Member – This property control what is displayed in the combo/list box.
3. Value Member – This property controls what is returned to our program when user makes a selection.
4. Remember to ensure that the fields under the DataBindings property are set to None.
When the user makes a selection in a listbox or combobox we need to retrieve the item selected from the listbox with the Value Member property. We can retrieve the property value with a statement such as:
newrow("MovieNumber") = movieTitlesListBox.SelectedValue.ToString
This line of code was included in the code for the checkout button listed above.
Updating a Database:
Update Method – The update method of the Table Adapter is used to pass the changes from the dataset in memory to the database. Visual Studio 2015 will create the update logic automatically for you when you drag fields from the dataset to your form. Here are a few links to some interesting articles that discusses how to create a project that updates a database
This form will allow the user to display all of the previous video rentals for a customer. The Customer ID and Name are displayed based on the current selected user on the Main Form. The customer name is concatenated from the textboxes on the Main Form. This is similar to the process you would have used for the Summary form when you completed your Chapter 6 homework.
This type of query is used to only retrieve records that match some criteria. For example, to retrieve only the videos rented by a certain customer id. In Visual Studio we can create a parameterized query by right clicking on the data source and choosing Edit Dataset with Designer.
In this example I have created the Dataset with only the CustomerRental table. We can then modify this query to add all tables we want and select the fields to display from each table. Right clicking on the TableAdapter will allow us to configure the Fill method.
When the Configuration Wizard displays click the Query Builder button.
In Query Builder you can configure the query to include the Video table, select the appropriate fields to be displayed in the results returned to our program. In the Filter column enter an “=?”, and then click out of the field. This will add a parameter that will then need to be sent to the query anytime it is called. In your forms code add a statement like this:
The Integer.Parse(customerIDLabel.Text) will pass whatever data is entered in the CustomerIDLabel to the query. Remember to fill this field before displaying the form from whatever form is opening it. For example, in the Term Project I set the labels on the RentalsForm from the MainForm.
The Tables in the DB and their fields are as follows:
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
Partial Class AboutForm
'Form overrides dispose to clean up the component list.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.btnExit = New System.Windows.Forms.Button()
Me.lblProductDescription = New System.Windows.Forms.Label()
Me.lblCopyrightYear = New System.Windows.Forms.Label()
Me.lblVersionValue = New System.Windows.Forms.Label()
Me.lblProduct = New System.Windows.Forms.Label()
Me.lblMidlands = New System.Windows.Forms.Label()
Me.lblDescription = New System.Windows.Forms.Label()
Me.lblCopyright = New System.Windows.Forms.Label()
Me.lblVersion = New System.Windows.Forms.Label()
Me.lblProductName = New System.Windows.Forms.Label()
Me.lblCompanyName = New System.Windows.Forms.Label()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.btnExit.Location = New System.Drawing.Point(283, 405)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(75, 29)
Me.btnExit.TabIndex = 36
Me.btnExit.Text = "Exit"
Me.btnExit.UseVisualStyleBackColor = True
Me.lblProductDescription.AutoSize = True
Me.lblProductDescription.Location = New System.Drawing.Point(319, 291)
Me.lblProductDescription.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblProductDescription.Name = "lblProductDescription"
Me.lblProductDescription.Size = New System.Drawing.Size(342, 17)
Me.lblProductDescription.TabIndex = 35
Me.lblProductDescription.Text = "We give video rentals with excellent customer service"
Me.lblCopyrightYear.AutoSize = True
Me.lblCopyrightYear.Location = New System.Drawing.Point(319, 243)
Me.lblCopyrightYear.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblCopyrightYear.Name = "lblCopyrightYear"
Me.lblCopyrightYear.Size = New System.Drawing.Size(118, 17)
Me.lblCopyrightYear.TabIndex = 34
Me.lblCopyrightYear.Text = "Copyright © 2020"
Me.lblVersionValue.AutoSize = True
Me.lblVersionValue.Location = New System.Drawing.Point(319, 198)
Me.lblVersionValue.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblVersionValue.Name = "lblVersionValue"
Me.lblVersionValue.Size = New System.Drawing.Size(104, 17)
Me.lblVersionValue.TabIndex = 33
Me.lblVersionValue.Text = "Version 126.96.36.199"
Me.lblProduct.AutoSize = True
Me.lblProduct.Location = New System.Drawing.Point(319, 151)
Me.lblProduct.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblProduct.Name = "lblProduct"
Me.lblProduct.Size = New System.Drawing.Size(197, 17)
Me.lblProduct.TabIndex = 32
Me.lblProduct.Text = "Rag Video Store Term Project"
Me.lblMidlands.AutoSize = True
Me.lblMidlands.Location = New System.Drawing.Point(319, 111)
Me.lblMidlands.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblMidlands.Name = "lblMidlands"
Me.lblMidlands.Size = New System.Drawing.Size(180, 17)
Me.lblMidlands.TabIndex = 31
Me.lblMidlands.Text = "Midlands Technical College"
Me.lblDescription.AutoSize = True
Me.lblDescription.Location = New System.Drawing.Point(93, 291)
Me.lblDescription.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblDescription.Name = "lblDescription"
Me.lblDescription.Size = New System.Drawing.Size(79, 17)
Me.lblDescription.TabIndex = 30
Me.lblDescription.Text = "Description"
Me.lblCopyright.AutoSize = True
Me.lblCopyright.Location = New System.Drawing.Point(93, 243)
Me.lblCopyright.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblCopyright.Name = "lblCopyright"...