Lab4_2
This commit is contained in:
52
Lab4_2/Lab4_6_CalebFontenot/Form1.cs
Executable file
52
Lab4_2/Lab4_6_CalebFontenot/Form1.cs
Executable file
@@ -0,0 +1,52 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user