46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
|
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());
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|