Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Example Program 1 - Capital City

The document describes a simple program that asks the user to select the capital city of England from a dropdown menu. When the user clicks the "Check" button, the program stores their selection in a variable and checks if it is equal to "London". If it is, a message displays "Correct, the capital city of England is: London". Otherwise, it displays "Wrong, try again!" to give feedback to the user.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Example Program 1 - Capital City

The document describes a simple program that asks the user to select the capital city of England from a dropdown menu. When the user clicks the "Check" button, the program stores their selection in a variable and checks if it is equal to "London". If it is, a message displays "Correct, the capital city of England is: London". Otherwise, it displays "Wrong, try again!" to give feedback to the user.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Example program 1 -

Capital City
The code for the program below ask the user the capital city
of England and display a suitable message depending on
whether they enter London.
Interface

Code when btnCheck is clicked

'stores the user selection from the combo box in the variable city

Dim city As String = cmbCity.Text

'checks if the city variable has London stored in it

If city = "London" Then

'displays correct if the condition is true

MessageBox.Show("Correct, the capital city of England is: " & city)

Else

'displays wrong if they have entered something else

MessageBox.Show("Wrong, try again!")


End If

This is what happens when the button is clicked:

You might also like