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
Name the different type of vegetation found in India ?​
maw [93]
Tropical Rainforests, Tropical Deciduous Forests, Tropical Thorn Forests and Scrubs, Montane Forests and Mangrove Forests.
4 0
2 years ago
Read 2 more answers
Price of ETH coin right now?<br> Don't answer if u don't know.
zzz [600]

Answer:

58,715.40

Explanation:

5 0
2 years ago
Connected contacts require___ to open.
wariber [46]
Manual power





hope it helps you
6 0
3 years ago
The main advantage of a solid state drive is:
Sonbull [250]

the answer is they can store more information

4 0
3 years ago
Which of the following should you consider when
Alborosie

Answer:

  • future access
  • digital preservation

Explanation:

Some file formats are fiddly and difficult to open which also makes preservation harder.

3 0
2 years ago
Other questions:
  • Question: A famous Disney Movie partially takes place in this city.
    15·2 answers
  • A type of memory that is expensive and therefore is often used only in cache memory applications.
    15·2 answers
  • To print data sideways on a piece of paper, use the _______ page orientation setting.
    6·2 answers
  • You rub two red balloons against a wool scarf. What do you think will happen if you place the balloons near each other. Justify
    5·1 answer
  • Extinction of a species is always a negative impact on the Earth.<br><br> True<br> False
    8·1 answer
  • 4-Translate the following C program to MIPS assembly program (Please explain each instruction in your code by a comment and subm
    6·1 answer
  • When you write Click a picture in a word processing program which actions can you choose to perform on the image
    6·1 answer
  • Describe the differences between program development and program execution, including the installed software required for develo
    5·1 answer
  • Anyone want to play mine mincraft w/ me?
    9·1 answer
  • Find 10 real world challenges and their corresponding solutions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!