Question

In: Computer Science

Create a project called “Favorite Restaurants” that displays 3 of your most favorite restaurants when a...

Create a project called “Favorite Restaurants” that displays 3 of your most favorite restaurants when a button is clicked. The application’s form should contain three labels containing three of your favorite restaurants and two buttons named as “Show” and “Exit”. When it first runs only the buttons should be visible, but the labels should not be. [Hint: setting the “visible” property of a control to “false” makes it invisible until you set the property value to “true”.] Once the “Show” button is pressed, the form should show three restaurants in three separate labels. When “Exit” button is clicked the application should close. The detailed property specifications are as follows
The button that displays favorite activities should be named Its text should be “Show”
The button that closes the application should be named Its text should be “Exit”. Type the following line of code as part of button “Exit” click event Handler.
Me.close()

The form should have three label controls for each of your favorite activities. The labels should be named as lblResOne, lblResTwo and lblResThree. The label’s font property should be set to Times New Roman, bold, 14 point. The label’s Text Align property should be set to Middle Center.
The form’s title bar should read “Favorite Restaurants”
Think about how to make the labels not visible at first and then make them appear when the “Show” button is pressed.

Solutions

Expert Solution

'create following form interface

'A visual basic solution contains two main files

(1) Form1.Designer.vb (It generates code automatically when we drag and drop any control on form)

(2) Form.vb (The user code for form application)

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.lblResOne = New System.Windows.Forms.Label()
Me.lblResTwo = New System.Windows.Forms.Label()
Me.lblResThree = New System.Windows.Forms.Label()
Me.btnShow = New System.Windows.Forms.Button()
Me.btnExit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'lblResOne
'
Me.lblResOne.AutoSize = True
Me.lblResOne.Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold)
Me.lblResOne.Location = New System.Drawing.Point(59, 25)
Me.lblResOne.Name = "lblResOne"
Me.lblResOne.Size = New System.Drawing.Size(185, 22)
Me.lblResOne.TabIndex = 0
Me.lblResOne.Text = "Favorite Restaurant1"
Me.lblResOne.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'lblResTwo
'
Me.lblResTwo.AutoSize = True
Me.lblResTwo.Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblResTwo.Location = New System.Drawing.Point(59, 67)
Me.lblResTwo.Name = "lblResTwo"
Me.lblResTwo.Size = New System.Drawing.Size(185, 22)
Me.lblResTwo.TabIndex = 1
Me.lblResTwo.Text = "Favorite Restaurant2"
Me.lblResTwo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'lblResThree
'
Me.lblResThree.AutoSize = True
Me.lblResThree.Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold)
Me.lblResThree.Location = New System.Drawing.Point(59, 106)
Me.lblResThree.Name = "lblResThree"
Me.lblResThree.Size = New System.Drawing.Size(185, 22)
Me.lblResThree.TabIndex = 2
Me.lblResThree.Text = "Favorite Restaurant3"
Me.lblResThree.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'btnShow
'
Me.btnShow.Location = New System.Drawing.Point(34, 164)
Me.btnShow.Name = "btnShow"
Me.btnShow.Size = New System.Drawing.Size(75, 23)
Me.btnShow.TabIndex = 3
Me.btnShow.Text = "Show"
Me.btnShow.UseVisualStyleBackColor = True
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(170, 164)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(75, 23)
Me.btnExit.TabIndex = 4
Me.btnExit.Text = "Exit"
Me.btnExit.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(289, 230)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnShow)
Me.Controls.Add(Me.lblResThree)
Me.Controls.Add(Me.lblResTwo)
Me.Controls.Add(Me.lblResOne)
Me.Name = "Form1"
Me.Text = "Favorite Restaurants"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

Friend WithEvents lblResOne As Label
Friend WithEvents lblResTwo As Label
Friend WithEvents lblResThree As Label
Friend WithEvents btnShow As Button
Friend WithEvents btnExit As Button
End Class

'Form1.vb

Public Class Form1
'When from is loaded, it makes labels invisible
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lblResOne.Visible = False
lblResThree.Visible = False
lblResTwo.Visible = False
End Sub

Private Sub btnShow_Click(sender As Object, e As EventArgs) Handles btnShow.Click
'When user click show button
'all levels are visible
lblResOne.Visible = True
lblResThree.Visible = True
lblResTwo.Visible = True
End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()

End Sub
End Class

''Output

'If you need any help regarding this solution...... please leave a comment..... thanks


Related Solutions

a) Using vi (or from your favorite editor) create a file called myscript. Enter the following...
a) Using vi (or from your favorite editor) create a file called myscript. Enter the following text into the myscript file. #!/bin/bash echo -e "this is a sample shell script. \t It displays mounted filesystems \a" mount b) Now, save the file and quit the editor. c) type ls -l myscript and hit enter. What permissions do you have on the file? d) type bash myscript and hit enter. What did it do? e) what does the \t and \a...
Problem 1 Create a new project called Lab7 Create a class in that project called ListORama...
Problem 1 Create a new project called Lab7 Create a class in that project called ListORama Write a static method in that class called makeLists that takes no parameters and returns no value In makeLists, create an ArrayList object called avengers that can hold String objects. Problem 2 Add the following names to the avengers list, one at a time: Chris, Robert, Scarlett, Clark, Jeremy, Gwyneth, Mark Print the avengers object. You will notice that the contents are displayed in...
Create a PLSQL block that retrieves and displays information for a specific project based on project...
Create a PLSQL block that retrieves and displays information for a specific project based on project ID. Display the following on a single row of output: project ID, project name, number of pledges made, total dollars pledged, and the average pledge amount
You are dining at your favorite restaurant and eating your favorite meal when you start to...
You are dining at your favorite restaurant and eating your favorite meal when you start to think about the digestion process (sorry to ruin your meal). Briefly explain this process when food enters your stomach then in your small intestine. Include the following terms/structures in your explanation: stomach; chyme; hydrochloric acid; 3 basic tasks of stomach; length of time in stomach; 3 structural parts of small intestine; describe what happens in the first 25 centimeters of the small intestine; role...
Instructions (No array) (c++) (visual studio) 1. Create a project called Project3B 2. Create 3 String...
Instructions (No array) (c++) (visual studio) 1. Create a project called Project3B 2. Create 3 String variables called name1, name2, name3 3. Create 9 double variables called test1_1, test1_2, test1_3, test2_1, test2_2, test2_3, test3_1, test3_2, test3_3 4. Create 3 double variables called average1, average2, average3 To calculate the average score = (test1 + test2 + test3) / 3.0 5. Run the program with the following data using cin name1 = “Tom”, name2 = “Mary”, name3 = “Ali” test1_1 = 81.4,...
In the root of the project create a folder called res. In that folder create a...
In the root of the project create a folder called res. In that folder create a file called DemoFile.txt Create a class with a static main that tests the ability to resolve and print a Path: Create an instance of a FileSystem class. Create an instance of the Path interface for the DemoFile.txt file. Print the constructed Path with System.out.println() method. Create a class that does the following: Using a pre-Java 7 solution, create a class that tests streams in...
In BlueJ, create a project called Lab6 Create a class called LineSegment –Note: test changes as...
In BlueJ, create a project called Lab6 Create a class called LineSegment –Note: test changes as you go Copy the code for LineSegment given below into the class. Take a few minutes to understand what the class does. Besides the mutators and accessors, it has a method called print, that prints the end points of the line segment in the form: (x, y) to (x, y) You will have to write two methods in the LineSegment class. There is information...
2. Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a...
2. Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X...
You first needs to create a file called “myJS.js” in your project directory. Then, include the...
You first needs to create a file called “myJS.js” in your project directory. Then, include the AngularJS library and myJS.js in the header of the index.html page. Now, you need to define your angular application and a controller in this file such that the controller has the following variables with these initial values: name = "Alex Cool"; faculty= "Faculty of Busienss and IT"; university = {name:"University of Ontario Institute of Technology", url:"http://www.uoit.ca"}; contacts = {email:"[email protected]", phone:"xxx-xxx-xxxx"}; skills = [ {name:...
Create a Project and a Class called “FinalGrade” Write a Java program to compute your final...
Create a Project and a Class called “FinalGrade” Write a Java program to compute your final grade for the course. Assume the following (you can hard-code these values in your program). Assignments are worth 30% Labs are worth 40% Mid-term is worth 15% Final is worth 15% Ask for the grades in each category. Store them in a double variable. Print out the final percentage grade.           For example, Final Grade Calculation Enter percentage grades in the following order. Assignments,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT