1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xeze [42]
3 years ago
6

Write an application that allows a user to select a country from a list box that contains the following seven options. After the

user makes a selection, display the country’s capital city.
Country
Capital Austria
Vienna Canada
Toronto England
London France
Paris Italy
Rome Mexico
Mexico City Spain
Madrid
Computers and Technology
1 answer:
hodyreva [135]3 years ago
6 0

Answer:

Programming Language not stated;

But this application definitely requires a graphical user interface platform (so, I'll use Microsoft Visual C# - Winforms).

Controls to be used are.

1. Form

2. List box

I'll name the Form, Form1 and the list box, listbox1.

Explanation:

The code goes thus;

private void Form1_Load(object sender, System.EventArgs e)

{

//Load country into empty listbox

listbox1.Items.Add("Austria");

listbox1.Items.Add("Canada");

listbox1.Items.Add("England");

listbox1.Items.Add("France");

listbox1.Items.Add("Italy");

listbox1.Items.Add("Mexico");

listbox1.Items.Add("Spain");

}

private void listbox1_SelectedIndexChanged(object sender, System.EventArgs e)

{

//Check if an item is really selected

if(listbox1.SelectedIndex >= 0)

{

//Index 0 represents 1st item that was added to the listbox and that's Austria

if(listbox1.SelectedIndex ==0)

{

MessageBox.Show("Vienna");

}

else if(listbox1.SelectedIndex == 1)

{

MessageBox.Show("Toronto");

}

else if(listbox1.SelectedIndex ==2)

{

MessageBox.Show("London");

}

else if(listbox1.SelectedIndex == 3)

{

MessageBox.Show("Paris");

}

else if(listbox1.SelectedIndex ==4)

{

MessageBox.Show("Rome");

}

else if(listbox1.SelectedIndex == 5)

{

MessageBox.Show("Mexico City");

}

else if(listbox1.SelectedIndex == 6)

{

MessageBox.Show("Madrid");

}

}

else

{

MessageBox.Show("No item selected");

}

}

You might be interested in
Why hackers hack?? in other people?​
pshichka [43]
Could you please reword this question. i don’t get what you’re asking
8 0
3 years ago
Read 2 more answers
Both instructions and data in a digital<br>computer are represented as binary<br>digits. True False​
MrRissso [65]

Answer:

False

Explanation:

insturctions are represented in binary numbers, data are represented in decimal numbers.

6 0
2 years ago
The following types of websites are
zzz [600]
Mmm what are u talking abouy
3 0
3 years ago
Which of the following are characteristics of a good webmail message select all that apply
emmainna [20.7K]

add choices please :)


6 0
3 years ago
50 POINTS! What can be viewed in the Tasks folder? Check all that apply.
Rom4ik [11]

1, 2, and 4 :))) good luck

6 0
3 years ago
Read 2 more answers
Other questions:
  • Universal Containers are using Salesforce for Order Management and has integrated with an in-house ERP system for order fulfilme
    5·1 answer
  • Write a Python program that gets a single character from the user and writes out a congratulatory message if the character is a
    9·1 answer
  • What formatting option is easiest to read when printed out
    12·1 answer
  • Jason is creating a web page for his school's basketball team. He just finished creating his storyboard. Which tool should he us
    6·2 answers
  • 1. Accessing calendars, contact information, emails, files and folders, instant messages, presentation, and task lists over the
    7·1 answer
  • What was a result of george washington's belief in the sovereignty of the people instead of monarchy?
    9·1 answer
  • The term integration mean?
    7·2 answers
  • Discuss how a lack of infrastructure in poor communities could contribute to ill-health such as the Unrest looting.​
    9·1 answer
  • ________ take advantage of vulnerabilities in software. Group of answer choices Blended threats Bots Trojan horses Direct-propag
    6·1 answer
  • Rr lyrae stars pulsate, but with shorter periods and lower luminosities than cepheids. true false
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!