Está en la página 1de 3

Manual de Visual Basic Intermedio

Autor: Jorge Alvarez


Curso:

9,45/10 (20 opiniones) |22740 alumnos|Fecha publicacin: 17/03/2006


Enva un mensaje al autor

Captulo 11:
Ejercicio 11: Calificaciones

Crea un formulario con ocho etiquetas, nueve cajas de texto, tres botones
ye escribe el siguiente cdigo:

El botn Salir

Private Sub Command3_Click()

Unload Me

End

End Sub

El botn Limpiar

Private Sub Command2_Click()


Text1 = ""

Text2 = ""

Text3 = ""

Text4 = ""

Text5 = ""

Text6 = ""

Text7 = ""

Text8 = ""

Text9 = ""

Text1.SetFocus

End Sub

El botn Prom. Gral. Redondeado

Private Sub Command1_Click()

Dim n1 As Double, n2 As Double, n3 As Double, n4 As Double, n5 As


Double, n6 As Double

Dim promedio As Integer

n1 = Val(Text2): n2 = Val(Text3)

n3 = Val(Text4): n4 = Val(Text5)

n5 = Val(Text6): n6 = Val(Text7)

promedio = ((n1 + n2 + n3 + n4 + n5 + n6) / 6)

Text8 = Str(promedio)

If promedio >= 9.5 Then

Text9 = "Excelente"
End If

If promedio >= 9 And promedio < 9.5 Then

Text9 = "Muy Bien"

End If

If promedio >= 8.5 And promedio < 9 Then

Text9 = "Bien"

End If

If promedio >= 8 And promedio < 8.5 Then

Text9 = "Regular"

End If

If promedio < 8 Then

Text9 = "Mal"

End If

End Sub

También podría gustarte