Está en la página 1de 2

rivate Sub CALCULASToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CALCULASToolStripMenuItem.Click Dim promedio As Single LBLPUNTOS.Text = Val(TextBox2.Text) + Val(TextBox3.

Text) + Val(TextBox4.Text) promedio = LBLPUNTOS.Text / 3 If promedio >= 10.5 Then LBLPROMEDIO.ForeColor = Color.Blue Else LBLPROMEDIO.ForeColor = Color.Red End If LBLPROMEDIO.Text = promedio.ToString("###,##0.00") If TextBox1.Text.Trim = "" Then MessageBox.Show("Ingrese el Nombre del Alumno", "Por Favor", MessageBoxButtons.OK, MessageBoxIcon.Information) TextBox1.Focus() Exit Sub End If If TextBox2.Text.Trim = "" Or Single.Parse(TextBox2.Text.Trim) < 0 Or Single.Parse(TextBox2.Text.Trim) > 20 Then MessageBox.Show("Ingrese nota entre 0 y 20", "Entre 0 y 20", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Text = "" TextBox2.Focus() Exit Sub End If If TextBox3.Text.Trim = "" Or Single.Parse(TextBox3.Text.Trim) < 0 Or Single.Parse(TextBox3.Text.Trim) > 20 Then MessageBox.Show("Ingrese nota entre 0 y 20", "Entre 0 y 20", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox3.Text = "" TextBox3.Focus() Exit Sub End If If TextBox4.Text.Trim = "" Or Single.Parse(TextBox4.Text.Trim) < 0 Or Single.Parse(TextBox4.Text.Trim) > 20 Then MessageBox.Show("Ingrese nota entre 0 y 20", "Entre 0 y 20", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox4.Text = "" TextBox4.Focus() Exit Sub End If Dim nota1, nota2, nota3, puntos As Single nota1 = Single.Parse(TextBox2.Text) nota2 = Single.Parse(TextBox3.Text) nota3 = Single.Parse(TextBox4.Text) puntos = nota1 + nota2 + nota3 promedio = puntos / 3 LBLPUNTOS.Text = puntos.ToString LBLPROMEDIO.Text = promedio.ToString If promedio >= 10.5 Then LBLPROMEDIO.ForeColor = Color.Blue Else LBLPROMEDIO.ForeColor = Color.Red End If

End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub NUEVOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NUEVOToolStripMenuItem.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" LBLPROMEDIO.Text = "" LBLPUNTOS.Text = "" TextBox1.Focus() End Sub Private Sub CERRARToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CERRARToolStripMenuItem.Click End End Sub End Class

También podría gustarte