ASDV-C-Sharp/MP3/CtoF_CalebFontenot/Form1.cs
2022-11-01 14:16:51 -05:00

46 lines
1.1 KiB
C#
Executable File

namespace CtoF_CalebFontenot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void calculateButton_Click(object sender, EventArgs e)
{
// Write to textbox.
//fahrenheitTextBox.Text = fahrenheit.ToString();
}
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
// Define variables
double fahrenheit, celsius;
// Populate Celcius list
for (int i = 0; i <= 20; i++)
{
celsiusListBox.Items.Add(i.ToString());
}
// Compute!
for (int i = 0; i < celsiusListBox.Items.Count; i++)
{
celsius = Double.Parse(celsiusListBox.Items[i].ToString());
fahrenheit = ((9 / 5) * celsius) + 32;
fahrenheitListBox.Items.Add(fahrenheit.ToString());
}
}
}
}