Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click
txtX0.Text = ""
txtX1.Text = ""
txtY0.Text = ""
txtY1.Text = ""
textBox5.Text = ""
textBox6.Text = ""
textBox7.Text = ""
TextBox10.BackColor = Color.White
TextBox10.ForeColor = Color.Black
TextBox10.ReadOnly = True
kelvintxt.BackColor = Color.White
kelvintxt.ForeColor = Color.Black
kelvintxt.ReadOnly = True
If String.IsNullOrEmpty(textBox4.Text) Then
MsgBox("Debe ingresar una temperatura")
Else
Dim temperatura As Double = Convert.ToDouble(textBox4.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
If radioButton1.Checked Then
celsiusKelvin(temperatura, kelvintxt)
Else
If radioButton2.Checked Then
fahrenheitKelvin(temperatura, kelvintxt)
Else
If radioButton3.Checked Then
temp = temperatura
kelvintxt.Text = Convert.ToString(temp)
End If
End If
End If
Dim temperaturaConvertida As Double = Convert.ToDouble(kelvintxt.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
If temperatura > 1000 And radioButton3.Checked = True Then
MsgBox("Debe ingresar una temperatura menor a 1000 grados kelvin")
Else
If temperaturaConvertida > 1000 And radioButton1.Checked = True Or radioButton2.Checked = True Then
MsgBox("La conversión no debe exceder los 1000 grados Kelvin")
Else
If textBox1.Text = "" Or textBox2.Text = "" Or textBox3.Text = "" Then
MsgBox("Debe seleccionar un gas de la tabla")
Else
Dim sigma As Double = Convert.ToDouble(textBox2.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
sig = sigma
elevarSigma()
textBox8.Text = Convert.ToString(sig)
If TextBox9.Text = "" Then
MsgBox("Debe ingresar la presión")
Else
Dim capturarPresion As Double = Convert.ToDouble(TextBox9.Text)
If Not capturarPresion > 0 And capturarPresion <= 10 Then
MsgBox("La presión debe ser menor a 10 y mayor a 0")
Else
validarYConvertirPresion(capturarPresion)
If temp > 1000 Then
MsgBox("Error, la temperatura debe ser menor a mil")
kelvintxt.BackColor = Color.White
kelvintxt.ForeColor = Color.Red
kelvintxt.ReadOnly = True
Else
If Convert.ToDouble(TextBox10.Text) < 1 Or Convert.ToDouble(TextBox10.Text) > 10 Then
MsgBox("Error, las atmosferas deben ser mayores a 0 y menores o igual a 10")
TextBox10.BackColor = Color.White
TextBox10.ForeColor = Color.Red
TextBox10.ReadOnly = True
textBox5.Text = ""
textBox6.Text = ""
textBox7.Text = ""
TextBox10.BackColor = Color.White
TextBox10.ForeColor = Color.Black
TextBox10.ReadOnly = True
kelvintxt.BackColor = Color.White
kelvintxt.ForeColor = Color.Black
kelvintxt.ReadOnly = True
txtX0.Text = ""
txtX1.Text = ""
txtY0.Text = ""
txtY1.Text = ""
Else
Dim pesomol As Double = Convert.ToDouble(textBox1.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
Dim k_a As Double = Convert.ToDouble(textBox3.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
pm = pesomol
k = k_a
obtenerX()
textBox5.Text = Convert.ToString(x)
obtenerXY()
If x0 = 0 And y0 = 0 Then
textBox4.Text = ""
textBox5.Text = ""
textBox6.Text = ""
textBox7.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox10.BackColor = Color.White
TextBox10.ForeColor = Color.Black
TextBox10.ReadOnly = True
kelvintxt.Text = ""
kelvintxt.BackColor = Color.White
kelvintxt.ForeColor = Color.Black
kelvintxt.ReadOnly = True
txtX0.Text = ""
txtX1.Text = ""
txtY0.Text = ""
txtY1.Text = ""
Else
txtX0.Text = Convert.ToString(x0)
txtX1.Text = Convert.ToString(x1)
txtY0.Text = Convert.ToString(y0)
txtY1.Text = Convert.ToString(y1)
obtenerOmega()
textBox6.Text = Convert.ToString(omeg)
obtenerM()
textBox7.Text = Convert.ToString(resultado)
textBox7.BackColor = Color.White
textBox7.ForeColor = Color.DarkBlue
textBox7.ReadOnly = True
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub