Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Calcular la edad
Crea un formulario con dos etiquetas, dos cajas de texto y tres botones,
escribe el siguiente cdigo:
El botn Calcular la Edad
Private Sub Command1_Click()
Dim fecnac As Date, edad As Integer
fecnac = CDate(Text1)
edad = CInt((Date - fecnac) / 365)
Text2 = Str(edad) & " aos"
End Sub
El botn Nuevo Clculo
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text1.SetFocus
End Sub
El botn Salir
Private Sub Command3_Click()
Unload Me
End
End Sub
Captulo 5:
Ejercicio 5: Fecha Escrita
End
Else: Call Command2_Click
End If
End Sub
Captulo 11:
Ejercicio 11: Calificaciones
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
Captulo 12:
Ejercicio 12: Impresin
Crea un formulario con seis etiquetas, seis cajas de texto, dos botones y escribe
el siguiente cdigo:
El botn Limpiar
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text1.SetFocus
End Sub
El botn Imprimir
Private Sub Command1_Click()
Printer.Orientation = 1
Printer.FontSize = 12
Printer.Print
Printer.Print
Printer.Print
Printer.Print Tab(15); Label1.Caption; Tab(30); Text1.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label2.Caption; Tab(30); Text2.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label3.Caption; Tab(30); Text3.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label4.Caption; Tab(30); Text4.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label5.Caption; Tab(30); Text5.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label6.Caption; Tab(30); Text6.Text
Printer.EndDoc
End Sub