using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace grados_en_celcius
{
public partial class Form1 : Form
{double tem,fah,cel=0;
public Form1()
{
tem = fah = cel = 0;
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
tem = double.Parse(textBox1.Text);
string tipo = (textBox2.Text);
if (tipo == "f" tipo == "F")
{cel = (5.0 / 9.0) * (tem - 32.0);
textBox3.Text = cel.ToString();
textBox5.Text = tem.ToString();
}else {if(tipo=="c"tipo=="C")
{fah=(9.0/5.0)*(tem+32.0);
textBox6.Text=fah.ToString();
textBox4.Text=tem.ToString();
}else
{textBox1.Text=("datos incorrectos");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace grados_en_celcius
{
public partial class Form1 : Form
{double tem,fah,cel=0;
public Form1()
{
tem = fah = cel = 0;
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
tem = double.Parse(textBox1.Text);
string tipo = (textBox2.Text);
if (tipo == "f" tipo == "F")
{cel = (5.0 / 9.0) * (tem - 32.0);
textBox3.Text = cel.ToString();
textBox5.Text = tem.ToString();
}else {if(tipo=="c"tipo=="C")
{fah=(9.0/5.0)*(tem+32.0);
textBox6.Text=fah.ToString();
textBox4.Text=tem.ToString();
}else
{textBox1.Text=("datos incorrectos");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}
No hay comentarios:
Publicar un comentario