This neighborhood store is an independently owned video rental business. The own
ID: 3760985 • Letter: T
Question
This neighborhood store is an independently owned video rental business. The owners would like to allow their customers to use the computer to look up the aisle number for movies by category. Create a form with a button for each category. When the user clicks on a button, display the corresponding aisle number in a label. Include a button to print and one to exit. Include a label that holds your name at the bottom of the form and change the title bar of the form to Video Bonanza. You may change the font properties of the labels to the font and size of your choice. Include additional categories, if you wish. Follow good programming conventions for object names; include remarks at the top of every procedure and at the top of the file.Explanation / Answer
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Drawing.Printing
Public Class VideoBonanzaForm
Inherits Form
'buttons for form
Public WithEvents comedybutton As Button
Public WithEvents dramabutton As Button
Public WithEvents actionbutton As Button
Public WithEvents scifibutton As Button
Public WithEvents horrorbutton As Button
Public WithEvents newreleasesbutton As Button
Public WithEvents printbutton As Button
Public WithEvents exitbutton As Button
'constructor
Public Sub New()
'sets title of form
Me.Text()="Video Bonanza"
'adding "Comedy" button
comedybutton = New Button()
comedybutton.Size = New Size(60, 30)
comedybutton.Location = New Point(30, 30)
comedybutton.Text = "Comedy"
Me.Controls.Add(comedybutton)
'adding "Drama" button
dramabutton = New Button()
dramabutton.Size = New Size(60, 30)
dramabutton.Location = New Point(30, 60)
dramabutton.Text = "Drama"
Me.Controls.Add(dramabutton)
'adding "Action" button
actionbutton = New Button()
actionbutton.Size = New Size(60, 30)
actionbutton.Location = New Point(30, 90)
actionbutton.Text = "Action"
Me.Controls.Add(actionbutton)
'adding "Sci-Fi" button
scifibutton = New Button()
scifibutton.Size = New Size(60, 30)
scifibutton.Location = New Point(30, 120)
scifibutton.Text = "Sci-Fi"
Me.Controls.Add(scifibutton)
'adding "Horror" button
horrorbutton = New Button()
horrorbutton.Size = New Size(60, 30)
horrorbutton.Location = New Point(30, 150)
horrorbutton.Text = "Horror"
Me.Controls.Add(horrorbutton)
'adding "New Releases" button
newreleasesbutton = New Button()
newreleasesbutton.Size = New Size(60, 30)
newreleasesbutton.Location = New Point(30, 180)
newreleasesbutton.Text = "New Releases"
Me.Controls.Add(newreleasesbutton)
'adding "Print" button
printbutton = New Button()
printbutton.Size = New Size(60, 30)
printbutton.Location = New Point(30, 210)
printbutton.Text = "Print"
Me.Controls.Add(printbutton)
'adding "Exit" button
exitbutton = New Button()
exitbutton.Size = New Size(60, 30)
exitbutton.Location = New Point(30, 240)
exitbutton.Text = "Exit"
Me.Controls.Add(exitbutton)
'label for displaying name at end of form
Dim namelabel As New label
namelabel.Size = New System.Drawing.Size(40, 40)
namelabel.Location = New System.Drawing.Point(Me.Size.Width(),Me.Size.Height())
namelabel.Text = "Your Name"
Me.Controls.Add(namelabel)
End Sub 'New
'event handler for comedy button
Private Sub comedybutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles comedybutton.Click
Dim comedylabel As New label
comedylabel.Size = New System.Drawing.Size(40, 60)
comedylabel.Location = New System.Drawing.Point(90,30)
comedylabel.Text = "Asile 1"
Me.Controls.Add(comedylabel)
End Sub
'event handler for drama button
Private Sub dramabutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles dramabutton.Click
Dim dramalabel As New label
dramalabel.Size = New System.Drawing.Size(40, 60)
dramalabel.Location = New System.Drawing.Point(90,60)
dramalabel.Text = "Asile 2"
Me.Controls.Add(dramalabel)
End Sub
'event handler for action button
Private Sub actionbutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles actionbutton.Click
Dim actionlabel As New label
actionlabel.Size = New System.Drawing.Size(40, 60)
actionlabel.Location = New System.Drawing.Point(90,90)
actionlabel.Text = "Asile 3"
Me.Controls.Add(actionlabel)
End Sub
'event handler for scifi button
Private Sub scifibutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles scifibutton.Click
Dim scifilabel As New label
scifilabel.Size = New System.Drawing.Size(40, 60)
scifilabel.Location = New System.Drawing.Point(90,120)
scifilabel.Text = "Asile 4"
Me.Controls.Add(scifilabel)
End Sub
'event handler for horror button
Private Sub horrorbutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles horrorbutton.Click
Dim horrorlabel As New label
horrorlabel.Size = New System.Drawing.Size(40, 60)
horrorlabel.Location = New System.Drawing.Point(90,150)
horrorlabel.Text = "Asile 5"
Me.Controls.Add(horrorlabel)
End Sub
'event handler for newreleases button
Private Sub newreleasesbutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles newreleasesbutton.Click
Dim newreleaseslabel As New label
newreleaseslabel.Size = New System.Drawing.Size(40, 60)
newreleaseslabel.Location = New System.Drawing.Point(90,180)
newreleaseslabel.Text = "Back Wall"
Me.Controls.Add(newreleaseslabel)
End Sub
'event handler for print button
Private Sub printbutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles printbutton.Click
Dim printDialog As New PrintDialog()
Dim printDocument As New PrintDocument()
printDialog.Document = printDocument
printDialog.PrinterSettings = printDocument.PrinterSettings
printDialog.AllowSelection = True
printDialog.AllowSomePages = True
If (printDialog.ShowDialog() = DialogResult.OK) Then
printDocument.PrinterSettings = printDialog.PrinterSettings
printDocument.Print()
End If
End Sub
'event handler for exit button
Private Sub exitbutton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles exitbutton.Click
Me.close()
End Sub
<STAThread()> _
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New VideoBonanzaForm())
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.