52 lines
1.5 KiB
C#
Executable File
52 lines
1.5 KiB
C#
Executable File
namespace Lab4_6_CalebFontenot
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
{
|
|
string city; // To hold the name of a city
|
|
|
|
if (cityListBox.SelectedIndex != -1)
|
|
{
|
|
// Get the selected list item
|
|
city = cityListBox.SelectedItem.ToString();
|
|
|
|
// Determine the time zone.
|
|
switch (city)
|
|
{
|
|
case "Honolulu":
|
|
timeZoneLabel.Text = "Hawaii-Aleutian";
|
|
break;
|
|
case "San Francisco":
|
|
timeZoneLabel.Text = "Pacific";
|
|
break;
|
|
case "Denver":
|
|
timeZoneLabel.Text = "Mountain";
|
|
break;
|
|
case "Minneapolis":
|
|
timeZoneLabel.Text = "Central";
|
|
break;
|
|
case "New York":
|
|
timeZoneLabel.Text = "Eastern";
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// No city was selected.
|
|
MessageBox.Show("Select a city.");
|
|
}
|
|
}
|
|
|
|
private void exitButton_Click(object sender, EventArgs e)
|
|
{
|
|
// Close the form.
|
|
this.Close();
|
|
}
|
|
}
|
|
} |