Programas y Códigos.docx

15
Formularios y Códigos 1. Suma de dos números 2. Promedio de 3 parciales 3. Multiplicación de dos números Private Sub Sumar_Click() Text3 = Val(Text1) + Val(Text2) End Sub Private Sub Borrar_Click() Text1 = " " Text2 = " " Text3 = " " End Sub Private Sub Salir_Click() End End Sub Private Sub Promediar_Click() Text4 = (Val(Text1) + Val(Text2)+ Val(Text3))/3 End Sub Private Sub Borrar_Click() Text1 = " " Text2 = " " Text3 = " " Text4 = " " End Sub Private Sub Salir_Click() End End Sub Private Sub Multiplicar_Click() Text3 = Val(Text1) * Val(Text2) End Sub Private Sub Borrar_Click() Text1 = " " Text2 = " "

Transcript of Programas y Códigos.docx

Page 1: Programas y Códigos.docx

Formularios y Códigos1. Suma de dos números

2. Promedio de 3 parciales

3. Multiplicación de dos números

Private Sub Sumar_Click()Text3 = Val(Text1) + Val(Text2)End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Promediar_Click()Text4 = (Val(Text1) + Val(Text2)+ Val(Text3))/3End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "Text4 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Multiplicar_Click()Text3 = Val(Text1) * Val(Text2)End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Page 2: Programas y Códigos.docx

4. Resta de dos números

5. División de dos números

6. Área de un circulo

Private Sub Restar_Click()Text3 = Val(Text1) - Val(Text2)End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Djvidir_Click()Text3 = Val(Text1) / Val(Text2)End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Page 3: Programas y Códigos.docx

Private Sub Area_Click()Text2 = (Val(Text1) * Val(Text1)) * 3.1416End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

7. Perímetro de un cuadro

8. Área de un triangulo

9. Venta de dos productos incluido el IVA

Private Sub Area_Click()Text2 = Val(Text1) * Val(Text1)End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Area_Click()Text3 = (Val(Text1) * Val(Text2) ) / 2End Sub

Private Sub Borrar_Click()Text1 = " "Text2 = " "Text3 = " "End Sub

Private Sub Salir_Click()EndEnd Sub

Page 4: Programas y Códigos.docx

Private Sub Subtotal_Click()Text3 = Val(Text1) + Val(Text2)End Sub

Private Sub Total_Click()Text4 = Val(Text3) * 1.16End Sub

Private Sub Borrar_Click()TexT1 = ""Text2 = ""Text3 = ""Text4 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

10. Hipotenusa de un triangulo rectángulo

11. Velocidad de un automóvil

11. Desarrollar el cuadrado de un numero

Private Sub Determinar_Click()Text3 = Math.Sqr ((Val(Text1) * Val(Text1)) + (Val(Text2) * Val(Text2)))End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""End Sub

Private Sub Salir_Click()End

Page 5: Programas y Códigos.docx

End SubEndEnd Su

Private Sub Velocidad_Click()Text3 = (Val(Text1) * 1000) * (Val(Text2) * 3600)End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Cuadrado_Click()Text2 = Val(Text1) * Val(Text1)End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

12. Minutos que hay en “x” días

13. Importe de películas rentadas

14. Convertidor de grados

Page 6: Programas y Códigos.docx

Private Sub Calcular_Click()Text2 = Val(Text1) * 1440End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Total_Click()Text4 = (Val(Text1) * 50) + (Val(Text2) * 30) + (Val(Text3) * 10)End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Convertir_Click()Text2 = ((9 / 5) * Val(Text1)) + 32End Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()End

End Sub

15. Determinar si un numero es negativo o positivo

16. Incrementar el sueldo de un empleado

Page 7: Programas y Códigos.docx

Private Sub Determinar_Click()If Val(Text1) >= 0 ThenText2 = "El numero es positivo"ElseText2 = "el numero es negativo"End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Determinar_Click()If Val(Text1) >= 1000 ThenText2 = "Aumento de 15%"Text3 = Val(Text1) * 0.15Text4 = Val(Text3) + Val(Text1)ElseText2 = "Aumento del 12%"Text3 = Val(Text1) * 0.12Text4 = Val(Text3) + Val(Text1)End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

17. Promedio de la materia aprobado o Reprobado

18. Es par o impar

Page 8: Programas y Códigos.docx

Private Sub Promediar_Click()Text4 = (Val(Text1) + Val(Text2) + Val(Text3)) / 3End Sub

Private Sub Determinar_Click()If Val(Text4) >= 6 ThenText5 = "Aprobado"ElseText5 = "Reprobado"End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""Text5 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Determinar_Click()If Val(Text1) Mod 2 ThenText2 = "Numero Impar"ElseText2 = "Numero Par"End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

19. Indicar si un numero esta entre 1000 y 2000

20. Lanzamiento de dados

Page 9: Programas y Códigos.docx

Private Sub Determinar_Click()If Val(Text1) >= 1000 And Val(Text1) <= 2000 ThenText2 = "Dentro del Rango"ElseText2 = "Fuera del Rango"End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Suma_Click()Text4 = Val(Text1) + Val(Text2) + Val(Text3)End Sub

Private Sub Determinar_Click()If Val(Text4) <= 18 And Val(Text4) >= 13 ThenText5 = "Excelente"ElseIf Val(Text4) <= 12 And Val(Text4) >= 7 ThenText5 = "Muy Bien"ElseIf Val(Text4) <= 6 And Val(Text4) >= 1 ThenText5 = "Regular"ElseIf Val(Text4) = 0 ThenText5 = "Pesimo"End IfEnd IfEnd IfEnd IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""Text5 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

21. Mayor de tres números

Page 10: Programas y Códigos.docx

22. Mayor de dos números

Private Sub Determinar_Click()If Val(Text1) > Val(Text2) And Val(Text1) > Val(Text3) ThenText4 = "El primer numero es el mayor"ElseIf Val(Text2) > Val(Text1) And Val(Text2) > Val(Text3) ThenText4 = "El segundo numero es el mayor"ElseIf Val(Text3) > Val(Text1) And Val(Text3) > Val(Text2) ThenText4 = "El tercer numero es el mayor"ElseText4 = "Son iguales"End IfEnd IfEnd IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Determinar_Click()If Val(Text1) > Val(Text2) ThenText3 = "El primer numero es el mayor"ElseIf Val(Text2) > Val(Text1) ThenElseText3 = "Son iguales"End IfEnd IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""End Sub

Private Sub Salir_Click()

Page 11: Programas y Códigos.docx

EndEnd Sub

23. Calificación de un alumno

24. Obtener beca

Private Sub Determinar_Click()If Val(Text1) = 10 ThenText2 = "Sobresaliente"ElseIf Val(Text1) = 8 ThenText2 = "Notable"ElseIf Val(Text1) = 6 ThenText2 = "Aprobado"ElseIf Val(Text1) <= 5 ThenText2 = "REPROBADO"End IfEnd IfEnd IfEnd IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Page 12: Programas y Códigos.docx

Private Sub Promedio_Click()Text4 = (Val(Text1) + Val(Text2) + Val(Text3)) / 3End Sub

Private Sub Determinar_Click()If Val(Text4) >= 9 ThenText5 = "Obtiene la beca"ElseText5 = "No obtiene la beca"End IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""Text5 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

25. Mayor de tres variables

26. Puede o no votar

Private Sub Determinar_Click()If Val(Text1) > Val(Text2) And Val(Text2) > Val(Text3) ThenText4 = "a, b, c"ElseIf Val(Text1) > Val(Text3) And Val(Text3) > Val(Text2) ThenText4 = "a, c, b"Else

Page 13: Programas y Códigos.docx

If Val(Text2) > Val(Text1) And Val(Text1) > Val(Text3) ThenText4 = "b, a, c"ElseIf Val(Text2) > Val(Text3) And Val(Text3) > Val(Text1) ThenText4 = "b, c, a"ElseIf Val(Text3) > Val(Text1) And Val(Text1) > Val(Text2) ThenText4 = "c, a, b"ElseIf Val(Text3) > Val(Text2) And Val(Text2) > Val(Text1) ThenText4 = "c, b, a"ElseText4 = "Son iguales"End IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd SubPrivate Sub Borrar_Click()Text1 = ""Text2 = ""Text3 = ""Text4 = ""End Sub

Private Sub Salir_Click()EndEnd Sub

Private Sub Command1_Click()If Val(Text1) >= 18 ThenText2 = "Puede votar"ElseIf Val(Text1) < 18 ThenText2 = "No puede votar"End IfEnd IfEnd Sub

Private Sub command2_Click()Text1 = ""Text2 = ""End Sub

Private Sub Command3_Click()EndEnd Sub

28. Valores numéricos y días de la semana Private Sub Determinar_Click()

Page 14: Programas y Códigos.docx

If Val(Text1) = 1 ThenText2 = "Domingo"ElseIf Val(Text1) = 2 ThenText2 = "Lunes"ElseIf Val(Text1) = 3 ThenText2 = "Martes"ElseIf Val(Text1) = 4 ThenText2 = "Miercoles"ElseIf Val(Text1) = 5 ThenText2 = "Jueves"ElseIf Val(Text1) = 6 ThenText2 = "Viernes"ElseIf Val(Text1) = 7 ThenText2 = "Sabado"End IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd Sub

Private Sub Borrar_Click()Text1 = ""Text2 = ""End Sub

Private Sub Salir_Click()EndEnd Sub