Question

In: Computer Science

Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters...

Using Visual Basic 2017,

Create a form with two textboxes and one button. A user enters the course she is taking in the first text box and then clicks on the button. Then if the user entered "Program Language" in the first text box, the second text box will show "Awesome pick!". If the user entered something else, the text box shows "Ok."

Please write the correct code.

Solutions

Expert Solution

'Vb Code

'Form Interface

'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.txtInput = New System.Windows.Forms.TextBox()
        Me.txtOutput = New System.Windows.Forms.TextBox()
        Me.btnDisplay = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'txtInput
        '
        Me.txtInput.Location = New System.Drawing.Point(102, 33)
        Me.txtInput.Name = "txtInput"
        Me.txtInput.Size = New System.Drawing.Size(100, 20)
        Me.txtInput.TabIndex = 0
        '
        'txtOutput
        '
        Me.txtOutput.Location = New System.Drawing.Point(102, 93)
        Me.txtOutput.Name = "txtOutput"
        Me.txtOutput.Size = New System.Drawing.Size(100, 20)
        Me.txtOutput.TabIndex = 1
        '
        'btnDisplay
        '
        Me.btnDisplay.Location = New System.Drawing.Point(102, 158)
        Me.btnDisplay.Name = "btnDisplay"
        Me.btnDisplay.Size = New System.Drawing.Size(100, 49)
        Me.btnDisplay.TabIndex = 2
        Me.btnDisplay.Text = "Click Me"
        Me.btnDisplay.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(21, 36)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(68, 13)
        Me.Label1.TabIndex = 3
        Me.Label1.Text = "Enter Course"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(21, 96)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(50, 13)
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "Message"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(288, 245)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.btnDisplay)
        Me.Controls.Add(Me.txtOutput)
        Me.Controls.Add(Me.txtInput)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Friend WithEvents txtInput As TextBox
    Friend WithEvents txtOutput As TextBox
    Friend WithEvents btnDisplay As Button
    Friend WithEvents Label1 As Label
    Friend WithEvents Label2 As Label
End Class

'Form1.vb

Public Class Form1
    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
        ' if user does not enter any value
        If txtInput.Text = "" Then
            txtOutput.Text = "Please enter course"
        Else
            ' compare course name(case insensitive)
            If txtInput.Text.ToLower() = "program language" Then
                txtOutput.Text = "Awesome pick!"
            Else
                txtOutput.Text = "Ok"
            End If
        End If

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ' make the output text  box read only
        txtOutput.ReadOnly = True
    End Sub
End Class

'Output

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


Related Solutions

Description: To create a Visual Basic program that will obtain a sentence from the user, parse...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse the sentence, and then display a sorted list of the words in the sentence with duplicate words removed. Tasks: Design a method (algorithm) to solve the above problem using pseudocode or a flowchart. Translate your algorithm into an appropriate VB program and test it using the following input sentence. "We are the world We are the children" Submit: Pseudocode version of algorithm/Flowchart version of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of seconds and produces output according to the following criteria: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
Create a program in visual basic that allows the user to manage vehicle information including: •...
Create a program in visual basic that allows the user to manage vehicle information including: • License plate number • Owner name • Owner phone number The user interface will be GUI-based providing the following capabilities: • Add up to 100 vehicles • Remove specified vehicles • View a sorted list of all known license plates • View the data for a specified vehicle • Save the database contents into a file • Load a saved database from a file
create a Visual Basic project with the following features: 1. The user interface can display the...
create a Visual Basic project with the following features: 1. The user interface can display the following information, one textbox for one item: 1a. Author, in the form of Lastname, Firstname 1b. Title 1c. Source -- where the paper is published 1d. Abstract 1e. Publication year (This information is in the 1c. Source, but display the publication year separately here) 2. There is a command button "Import". It would allow the user to select the eric.txt as the input file...
Using an ArrayList, create a program which does the following: If the user enters quit, the...
Using an ArrayList, create a program which does the following: If the user enters quit, the program ends. If the user enters add followed by a string, program adds the string only to your ArrayList. If the user enters print, the program prints out the ArrayList contents. If the user enters size, the program prints out size of ArrayList, If the user enters remove followed by string, it removes all strings. interface example: **** Welcome to my List Program ****...
Your task is to create a book ordering form using VISUAL STUDIOS, with the code and...
Your task is to create a book ordering form using VISUAL STUDIOS, with the code and screenshots 1. Boxes for first name, last name, address. 2. Radio buttons to select: hard cover, soft cover, ebook. 3. Drop down list to select the book (make up three or four book names). 4. Radio buttons to select credit card (at least Visa, Master Card, American Express). 5. Box to enter credit card numbers. 6. The credit card box MUST verify that numbers...
Using If-Else conditional statement write a Visual Basic Program to display: (i) “STOP” if the user...
Using If-Else conditional statement write a Visual Basic Program to display: (i) “STOP” if the user enters “R” (ii) “CAUTION” if the user enters “Y” (iii) “GO” if the user enters “G” (iv) “Invalid” if the user enters any other character
Create a message encoder/decoder. PLEASE USE BASIC PYTHON METHODS/FUNCTIONS. The user enters a message that could...
Create a message encoder/decoder. PLEASE USE BASIC PYTHON METHODS/FUNCTIONS. The user enters a message that could only include alphabetic letters and space. There are 26 alphabetic letters. Consider space the 27th letter. The user then enters a shift code that should be an integer between -26 and 26. The application will show the encoded/decoded message based on the shift code entered. If you encode a message, each letter in the message will be moved forward through the alphabet according to...
Create a windows application that contains two TextBox objects and two Button objects. One of the...
Create a windows application that contains two TextBox objects and two Button objects. One of the TextBox objects and one of the buttons are initially invisible. The first textbox should be used to input a password. The textbox should be masked to some character of your choice so that the characters entered by the user are not seen on the screen. When the user clicks the first button, the second TextBox object and button object should be displayed with a...
In c# I need to create a simple payroll management system using visual basic and GUI....
In c# I need to create a simple payroll management system using visual basic and GUI. I also need to connect to SQL database. It needs a log in screen, inside the login screen it needs another screen to enter or edit employee information. It needs somewhere to enter hours worked for that specific employee, and another screen that can access reports.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT