Visual Basic Help Design and code a project that displays the location of videos
ID: 3762346 • Letter: V
Question
Visual Basic Help
Design and code a project that displays the location of videos using radio buttons. Use a radio burron for each of the mobie categories and a label to display the aisle number. A check box will allow the user to display or hide a message for members. When the check box is selected, a message stating "All Members Receive a 10% Discount" will appear. Include buttons (with keyboard access keys) for clear and exit. The clear button should be set as the Accept button and the Exit button as the Cancel button. Place a label on the form in 24-point font that reads (Video Bonanza". Use a line to seperate the label from the rest of the interface. Include an image in a picture box
Asile 2
Radio Buttons Location Comedy Asile 1 DramaAsile 2
Action Asile 3 Sci-Fi Asile 4 Horor Asile 5Explanation / Answer
MainForm.vb
-----------------------------------
Public Partial Class MainForm
'radio buttons for form
Public WithEvents comedybutton As RadioButton
Public WithEvents dramabutton As RadioButton
Public WithEvents actionbutton As RadioButton
Public WithEvents scifibutton As RadioButton
Public WithEvents horrorbutton As RadioButton
'check box for form
Public WithEvents msgcheckbox As CheckBox
'buttons for form
Public WithEvents clearbutton As Button
Public WithEvents exitbutton As Button
'labels
Public comedylabel As label
Public dramalabel As label
Public actionlabel As label
Public scifilabel As label
Public horrorlabel As label
Public msglabel As label
Public Sub New()
' The Me.InitializeComponent call is required for Windows Forms designer support.
Me.InitializeComponent()
'sets form properties
Me.Text()="Video Bonanza"
Me.Size=New Size(600,500)
Me.KeyPreview=True
'adding title label
Dim titlelabel As New label()
titlelabel.Size=New System.Drawing.Size(100, 15)
titlelabel.Location = New System.Drawing.Point(30,10)
titlelabel.Text = "Video Bonanza"
Me.Controls.Add(titlelabel)
'adding separator line
Dim separatorlabel As New label()
separatorlabel.AutoSize=False
separatorlabel.Height=2
separatorlabel.BorderStyle=BorderStyle.Fixed3D
separatorlabel.Location=New System.Drawing.Point(30,25)
Me.Controls.Add(separatorlabel)
'adding "Comedy" radio button
comedybutton = New RadioButton()
comedybutton.Location = New Point(30, 40)
comedybutton.Text = "Comedy"
comedybutton.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(comedybutton)
'adding comedy label
comedylabel = New label()
'comedylabel.Size = New System.Drawing.Size(40, 40)
comedylabel.Location = New System.Drawing.Point(200,40)
comedylabel.Text = "Asile 1"
Me.Controls.Add(comedylabel)
comedylabel.Hide()
'adding "Drama" radio button
dramabutton = New RadioButton()
dramabutton.Location = New Point(30, 70)
dramabutton.Text = "Drama"
dramabutton.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(dramabutton)
'adding drama label
dramalabel = New label()
'dramalabel.Size = New System.Drawing.Size(40, 40)
dramalabel.Location = New System.Drawing.Point(200,70)
dramalabel.Text = "Asile 2"
Me.Controls.Add(dramalabel)
dramalabel.Hide()
'adding "Action" radio button
actionbutton = New RadioButton()
actionbutton.Location = New Point(30, 100)
actionbutton.Text = "Action"
actionbutton.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(actionbutton)
'adding action label
actionlabel = New label()
'actionlabel.Size = New System.Drawing.Size(40, 40)
actionlabel.Location = New System.Drawing.Point(200,100)
actionlabel.Text = "Asile 3"
Me.Controls.Add(actionlabel)
actionlabel.Hide()
'adding "Sci-Fi" radio button
scifibutton = New RadioButton()
scifibutton.Location = New Point(30, 130)
scifibutton.Text = "Sci-Fi"
scifibutton.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(scifibutton)
'adding scifi label
scifilabel = New label()
'scifilabel.Size = New System.Drawing.Size(40, 40)
scifilabel.Location = New System.Drawing.Point(200,130)
scifilabel.Text = "Asile 4"
Me.Controls.Add(scifilabel)
scifilabel.Hide()
'adding "Horror" radio button
horrorbutton = New RadioButton()
horrorbutton.Location = New Point(30, 160)
horrorbutton.Text = "Horror"
horrorbutton.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(horrorbutton)
'adding horror label
horrorlabel = New label()
'horrorlabel.Size = New System.Drawing.Size(40, 40)
horrorlabel.Location = New System.Drawing.Point(200,160)
horrorlabel.Text = "Asile 5"
Me.Controls.Add(horrorlabel)
horrorlabel.Hide()
'adding "Message display" checkbox
msgcheckbox = New CheckBox()
msgcheckbox.Location = New Point(30, 190)
msgcheckbox.Text = "Select for 10% discount"
msgcheckbox.TextAlign=ContentAlignment.MiddleCenter
Me.Controls.Add(msgcheckbox)
msglabel = New label()
msglabel.Size=New System.Drawing.Size(300, 40)
msglabel.Location = New System.Drawing.Point(30,220)
msglabel.Text = "All Members Receive a 10% Discount."
Me.Controls.Add(msglabel)
msglabel.Hide()
'adding "Clear" button
clearbutton = New Button()
clearbutton.Size = New Size(50, 30)
clearbutton.Location = New Point(30, 260)
clearbutton.Text = "Clear"
Me.Controls.Add(clearbutton)
'adding "Exit" button
exitbutton = New Button()
exitbutton.Size = New Size(50, 30)
exitbutton.Location = New Point(90, 260)
exitbutton.Text = "Exit"
Me.Controls.Add(exitbutton)
'setting accept and cancel button
Me.AcceptButton=clearbutton
Me.CancelButton=exitbutton
End Sub
'event handler for comedy radio button
Private Sub comedybutton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comedybutton.CheckedChanged
comedylabel.Show()
End Sub
'event handler for drama radio button
Private Sub dramabutton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dramabutton.CheckedChanged
dramalabel.Show()
End Sub
'event handler for action radio button
Private Sub actionbutton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles actionbutton.CheckedChanged
actionlabel.Show()
End Sub
'event handler for scifi radio button
Private Sub scifibutton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scifibutton.CheckedChanged
scifilabel.Show()
End Sub
'event handler for horror radio button
Private Sub horrorbutton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles horrorbutton.CheckedChanged
horrorlabel.Show()
End Sub
'event handler for msgcheckbox
Private Sub msgcheckbox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles msgcheckbox.CheckedChanged
If msgcheckbox.Checked=True Then
msglabel.Show()
Else If msgcheckbox.Checked=False Then
msglabel.Hide()
End If
End Sub
'event handler for clear button
Private Sub clearbutton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles clearbutton.Click
comedybutton.Checked=False
dramabutton.Checked=False
actionbutton.Checked=False
scifibutton.Checked=False
horrorbutton.Checked=False
msgcheckbox.Checked=False
comedylabel.Hide()
dramalabel.Hide()
actionlabel.Hide()
scifilabel.Hide()
horrorlabel.Hide()
msglabel.Hide()
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
Private Sub MainForm_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode=Keys.C Then
clearbutton.PerformClick()
Else If e.KeyCode=Keys.E Then
exitbutton.PerformClick()
End If
End Sub
End Class
-----------------------------------------
Program.vb
-----------------------------------------------------------------
Imports Microsoft.VisualBasic.ApplicationServices
Namespace My
' This file controls the behaviour of the application.
Partial Class MyApplication
Public Sub New()
MyBase.New(AuthenticationMode.Windows)
Me.IsSingleInstance = False
Me.EnableVisualStyles = True
Me.SaveMySettingsOnExit = True
Me.ShutDownStyle = ShutdownMode.AfterMainFormCloses
End Sub
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = My.Forms.MainForm
End Sub
End Class
End Namespace
------------------------------------------------------------------
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.