2020 Grado Undécimo Tecnológica
domingo, 23 de agosto de 2020
domingo, 9 de agosto de 2020
Funciones de usuario
Function Porcentaje(arg1_Valor As Currency,
arg2_Porcentaje As Currency) As Currency
Porcentaje =
arg1_Valor * arg2_Porcentaje / 100
End Function
Function
ValiCodigo(Codigo As String) As Boolean
Dim Zona As String, CalendarioE As String,
NroMatricula As Integer
Dim Descuento As Currency, VlrMatricula As
Currency, NetoP As Currency
If Not Len(Codigo) =
5 Then
MsgBox
"El código debe ser de 5 caracteres", vbInformation,
"Error"
ValiCodigo = False
Exit Function
End If
Zona = UCase(Left(Codigo, 1))
Select Case Zona
Case "N", "C",
"S"
MsgBox "LA ES zona CORRECTA!", vbInformation, "OK"
Case Else
MsgBox
"Primer caracter debe ser N, C ó S", vbInformation, "Error"
ValiCodigo = False
Exit Function
End Select
CalendarioE = UCase(Mid(Codigo, 2, 1))
Select Case CalendarioE
Case "A", "B"
MsgBox "Estudiante de calendario A Ó B", vbInformation, "OK"
Case Else
MsgBox
"EL segundo caracter debe ser A ó B", vbInformation,
"Error"
ValiCodigo = False
Exit Function
End Select
If IsNumeric(Right(Codigo, 3)) Then
ValiCodigo = True
Else
MsgBox
"Los 3 ultimos caracteres deben ser nros", vbInformation,
"Error"
ValiCodigo = False
Exit Function
End If
End Function
Private Sub
CommandButton1_Click()
TextBox3 = Porcentaje(Val(TextBox1), Val(TextBox2))
If
ValiCodigo(TextBox4) Then
MsgBox
"Código Correcto!!", vbExclamation, "OK"
Else
MsgBox
"Error en el Código !!", vbCritical, "ERROR"
End If
End Sub