Fix the following if statement
Dim LastName As String = TxbLastName.Text
Dim FirstName As String = TxbFirstName.Text
If LastName = TxbLastName.Text Then
If FirstName = TxbFirstName.Text Then
MessageBox.Show("Complete User's Information")
Else
If Integer.TryParse(TxbAge.Text, Age) Then
If Age < 15 Or Age > 90 Then
MessageBox.Show("Age number must be at least from 15 to 90 years
old.",
"Invalid Number",
MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
BtnClear.Enabled = True
LtbAge.Items.Add(TxbAge.Text)
TxbAge.Text = " "
LtbLastName.Items.Add(TxbLastName.Text)
TxbLastName.Focus()
TxbLastName.Text = " "
LtbFristName.Items.Add(TxbFirstName.Text)
TxbFirstName.Text = " "
End If
With TxbAge
.Focus()
.Clear()
End With
End If
End If
Exit Sub
End If
End Sub
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new Windows Forms Application in VB is created using Visual Studio 2017 with name "DemoApplication".This application contains a form with name "Form1.vb".Below are the files associated with form1.
1.Form1.cs[Design]
2.Form1.Designer.cs
3.Form1.cs
Public Class Form1
'display button click
Private Sub btnDisplay_Click(sender As Object, e As EventArgs)
Handles btnDisplay.Click
Dim LastName As String = TxbLastName.Text
Dim FirstName As String = TxbFirstName.Text
Dim Age As Integer
'checking if last and first name is empty or not
If LastName = "" Or FirstName = "" Then
'if first and last name is empty then display messagebox
MessageBox.Show("Complete User's Information")
'checking whether age is numeric or not
ElseIf Integer.TryParse(TxbAge.Text, Age) Then
'checking age if age between 15 and 90
If Age < 15 Or Age > 90 Then
'if not between 15 and 90 display message box
MessageBox.Show("Age number must be at least from 15 to 90 years
old.", "Invalid Number", MessageBoxButtons.OK,
MessageBoxIcon.Information)
Else
'if first name , lastname and age is valid then
BtnClear.Enabled = True 'enable clear button
LtbAge.Items.Add(TxbAge.Text) 'add age in the listbox LtbAge
TxbAge.Text = " " 'clear textbox
LtbLastName.Items.Add(TxbLastName.Text) 'add last name in the
listbox LtbLastName
TxbLastName.Focus() 'set focus to the textbox LastName
TxbLastName.Text = " " 'clear textbox value
LtbFristName.Items.Add(TxbFirstName.Text) 'add first name in the
listbox LtbFristName
TxbFirstName.Text = " " 'clear textbox value
End If
Else
'if age is not numeric display message box
MessageBox.Show("Enter numeric age")
With TxbAge
.Focus()
.Clear()
End With
End If
Exit Sub
End Sub
End Class
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :
Screen 2 :Screen when first or last name is empty
Screen 3:Screen when age is non numeric
Screen 4:Screen when age is not in the range
Screen 5:Screen showing first name , last name and age in the list box
Screen 6:Screen showing first name , last name and age in the list box for couple of entries
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Fix the following if statement Dim LastName As String = TxbLastName.Text Dim FirstName As String ...
I really need some help fixing a code error in Visual Basic I was wondering if anyone could help fix the error that I'm about to provide in bold thanks so much! I'll also tell what the error is. Public Class MainForm Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click Me.Close() End Sub Dim img As Image = Image.FromFile("C:\Users\Pranesh\Pictures\11599264.jpg") house1PictureBox.Image = img house2PictureBox.Image = img house3PictureBox.Image = img house4PictureBox.Image = img house1PictureBox.Visible = False house2PictureBox.Visible = False house3PictureBox.Visible...
so im trying to make a grade program and idk what im doing wrong actually if someone can help? (heres the lines of code i have so far if its wrong let me know how to fix them Option Strict On Option Explicit On Public Class Form1 Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click Dim lblscore1 As Double Dim lblscore2 As Double Dim lblscore3 As Double lblscore1 = CDbl(Txtscore1.Text) lblscore2 = CDbl(Txtscore2.Text) lblscore3 = CDbl(Txtscore3.Text) lblaverage =...
In this exercise, you’ll add code to a form that converts the
value the user enters based on the selected conversion type.
The application should handle the following conversions:
1. Open the Conversions project. Display the code for the form,
and notice the rectangular array whose rows contain the value to be
displayed in the combo box, the text for the labels that identify
the two text boxes, and the multiplier for the conversion as shown
above. Note: An array...
Write following queries given these schemas: (FK stands for Foreign Key) Customer = {customerID, firstName, lastName, income, birthDate} Account = {accNumber, type, balance, branchNumberFK-Branch} Owns = {customerIDFK-Customer, accNumberFK-Account} Transactions = {transNumber, accNumberFK-Account, amount} Employee = {sin, firstName, lastName, salary, branchNumberFK-Branch} Branch = {branchNumber, branchName, managerSINFK-Employee, budget} Focus should be on using: Order By to sort data Set Operators to union/intersect multiple tables Join Operator to join multiple tables Aggregations and Group By to aggregate data Subqueries 3.15 Customer ID, first...
Windows operating system
1. Write a simple batch file named LastName Final.bat (where LastName is your own last name), which accomplishes the following: a Disable echo output b. Clear the screen c. Welcome the user with the following message (where current Date and curent Time is the computer's current date and current time, respectfully-these values should be output using a command line command, meaning do not type in the date or time into your batch file). A sample of this...
I need the following written in Java please, thank you
'
We want you to implement a java class that will show details on users and throw exceptions where needed. The following requirements specify what fields you are expected to implement in your User class: - A private String firstName that specifies the first name of the user - A private String lastName that specifies the last name of the user - A private int age that specifies user's age...
Java debugging in eclipse
package edu.ilstu;
import java.util.Scanner;
/**
* The following class has four independent debugging
* problems. Solve one at a time, uncommenting the next
* one only after the previous problem is working correctly.
*/
public class FindTheErrors {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
/*
* Problem 1 Debugging
*
* This problem is to read in your first name,
* last name, and current year and display them in
*...
Program using visual basic.net You will create a very simple two numbers calculator with save options; here is the specifications for the application. Create a form divided vertically in two halves with right and left panels 1- In the left panel you will create the following control, the label or the value of the control will be in "" and the type of the control will in [] a- "First Number" [textbox] b- "Second number" [texbox] c- "Result" [textbox] -...
Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...
public static void main(String[] args) { System.out.println("Welcome to the Future Value Calculator\n"); Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // get the input from the user System.out.println("DATA ENTRY"); double monthlyInvestment = getDoubleWithinRange(sc, "Enter monthly investment: ", 0, 1000); double interestRate = getDoubleWithinRange(sc, "Enter yearly interest rate: ", 0, 30); int years = getIntWithinRange(sc, "Enter number of years: ", 0, 100); System.out.println(); ...