You are on page 1of 3

Private Sub Command1_Click()

Dim n1 As Double, n2 As Double, n3 As Double

Dim promedio As Integer

n1 = Val(Text2)

n2 = Val(Text3)

n3 = Val(Text4)

promedio = (n1 + n2 + n3) / 3

Text7 = "su promedio es" & " " & promedio

frase = Trim(Text1)

Text6 = Len(frase) - 3

Text5 = "SR. " & Text1

End Sub

Private Sub Command2_Click()

Text1 = ""

Text2 = ""

Text3 = ""

Text4 = ""

Text5 = ""

Text6 = ""

Text7 = ""

End Sub
Private Sub Command3_Click()

Rpta = MsgBox("esta seguro de salir", 32 + 4, "terminar")

If Rpta = 6 Then

End

End If

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Then

MsgBox "nada de numeros"

KeyAscii = 8

End If

Dim I As Integer

Text1.Text = UCase(Text1.Text)

I = Len(Text1.Text)

Text1.SelStart = I

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 97) And (KeyAscii <= 122) Or (KeyAscii >= 65) And (KeyAscii < 90) Then

MsgBox "nada de letras"

KeyAscii = 8

End If
If Val(Text2) < 0 Or Val(Text2) > 20 Then

MsgBox "La nota debe estar entre" & Chr(13) & "0 & 20", 16, "Error"

End If

End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 97) And (KeyAscii <= 122) Or (KeyAscii >= 65) And (KeyAscii < 90) Then

MsgBox "nada de letras"

KeyAscii = 8

End If

If Val(Text3) < 0 Or Val(Text3) > 20 Then

MsgBox "La nota debe estar entre" & Chr(13) & "0 & 20", 16, "Error"

End If

End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 97) And (KeyAscii <= 122) Or (KeyAscii >= 65) And (KeyAscii < 90) Then

MsgBox "nada de letras"

KeyAscii = 8

End If

If Val(Text4) < 0 Or Val(Text4) > 20 Then

MsgBox "La nota debe estar entre" & Chr(13) & "0 & 20", 16, "Error"

End If

End Sub

You might also like