APLICACION Nº 01 Desarrollar una aplicación que permita ingresar

Anuncio
Visual Basic .Net
APLICACION Nº 01
Desarrollar una aplicación que permita ingresar el nombre
completo de un alumno y las tres notas obtenidas en el
curso de Visual Basic .Net
Deberá mostrar el puntaje obtenido y el promedio de dicho
curso. Si el alumno esta aprobado, su promedio deberá
mostrarse en color azul, de lo contrario en color rojo.
Public Class FrmPromedio
Private Sub BtnNuevo_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnNuevo.Click
TxtAlumno.Text = ""
TxtNota1.Text = ""
TxtNota2.Text = ""
TxtNota3.Text = ""
LblPuntos.Text = ""
LblPromedio.Text = ""
TxtAlumno.Focus()
End Sub
Private Sub BtnSalir_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnSalir.Click
Close()
End Sub
Ing. Henry Marcial Arévalo Flores
Página 1
Visual Basic .Net
Private Sub BtnCalcular_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnCalcular.Click
If TxtAlumno.Text.Trim = "" Then
MessageBox.Show("Ingrese el Nombre del Alumno",
"Por favor", MessageBoxButtons.OK,
MessageBoxIcon.Information)
'MsgBox("Ingrese el Nombre del Alumno",
MsgBoxStyle.Information, "Por Favor")
TxtAlumno.Focus()
Exit Sub
End If
If TxtNota1.Text.Trim = Nothing Or
Val(TxtNota1.Text.Trim) < 0 Or
Val(TxtNota1.Text.Trim) > 20 Then
MessageBox.Show("Ingrese La Primera Nota",
"Entre 0 y 20", MessageBoxButtons.OK,
MessageBoxIcon.Error)
TxtNota1.Text = ""
TxtNota1.Focus()
Exit Sub
End If
If TxtNota2.Text.Trim = "" Or
Val(TxtNota2.Text.Trim) < 0 Or
Val(TxtNota2.Text.Trim) > 20 Then
MessageBox.Show("Ingrese La Segunda Nota",
"Entre 0 y 20", MessageBoxButtons.OK,
MessageBoxIcon.Error)
TxtNota2.Text = ""
TxtNota2.Focus()
Exit Sub
End If
If TxtNota3.Text.Trim = "" Or
Val(TxtNota3.Text.Trim) < 0 Or
Val(TxtNota3.Text.Trim) > 20 Then
MessageBox.Show("Ingrese La Tercera Nota",
"Entre 0 y 20", MessageBoxButtons.OK,
MessageBoxIcon.Error)
TxtNota3.Text = ""
TxtNota3.Focus()
Exit Sub
End If
Ing. Henry Marcial Arévalo Flores
Página 2
Visual Basic .Net
Dim Nota1, Nota2, Nota3, Puntos, Promedio As Single
Nota1 = Single.Parse(TxtNota1.Text)
Nota2 = Single.Parse(TxtNota2.Text)
Nota3 = Single.Parse(TxtNota3.Text)
Puntos = Nota1 + Nota2 + Nota3
Promedio = Puntos / 3
If Promedio >= 10.5 Then
LblPromedio.ForeColor = Color.Blue
Else
LblPromedio.ForeColor = Color.Red
End If
LblPuntos.Text = Puntos.ToString
LblPromedio.Text = Promedio.ToString
End Sub
End Class
Ing. Henry Marcial Arévalo Flores
Página 3
Descargar