Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Formulario MDI
Programas utilizando MSGBOX
Elaborado por:
María José Díaz Interiano
Programa #2
Ingrese las cuatro notas y calcular el respectivo promedio, si este es menor al 70% el alumno esta reprobado de lo contario aprobó la asignatura
Codificación
Dim Promedio As DoubleDim Nota1, Nota2, Nota3, Nota4 As Integer
Private Sub CmdCerrar_Click() Unload MeEnd Sub
Private Sub CmdLimpiar_Click() TxtNota1.Text = "" TxtNota2.Text = "" TxtNota3.Text = "" TxtNota4.Text = ""End Sub
Private Sub CmdVerificar_Click() If TxtNota1.Text = "" Or TxtNota2.Text = "" Or TxtNota3.Text = "" Or TxtNota1.Text = "" Then MsgBox "Por favor llene todas las casillas", vbExclamation + vbOKOnly, "Error" Else Nota1 = Val(TxtNota1.Text) Nota2 = Val(TxtNota2.Text) Nota3 = Val(TxtNota3.Text) Nota4 = Val(TxtNota4.Text) Promedio = (Nota1 + Nota2 + Nota3 + Nota4) / 4 If Promedio <= 69.9 Then MsgBox "El alumno a reprobado. Su promedio es: " & Promedio, vbCritical + vbOKOnly, "Lo sentimos" Else MsgBox "El alumno a aprobado. Su promedio es: " & Promedio, vbEclamation + vbOKOnly, "Felicitaciones" End If End IfEnd Sub
Control Propiedad Valor
Tabla de objetos y propiedades
FrmEjercicio02 Name FrmEjercicio02Caption VacíoHeight 5490Width 7500
Label1 Name Label1Caption Ejercicio 2Autosize True
Label2 Name Label2Caption Ingrese las cuatro notas y
calcular el respectivo promedio, si este es menor al
70% el alumno esta reprobado de lo contario
aprobo la asignaturaAutosize True
FraNotas Name FraNotasCaption Notas I, II, III y IV parcialAutosize True
TxtNota1 Name TxtNota1Text VACÍO
Height 495Width 1215
TxtNota2 Name TxtNota2Text VACÍO
Height 495Width 1215
TxtNota3 Name TxtNota3Text VACÍO
Height 495Width 1215
TxtNota4 Name TxtNota4Text VACÍO
Height 495Width 1215
CmdVerificar Name CmdVerificarCaption VerificarHeight 495Width 1215
CmdLimpiar Name CmdLimpiarCaption LimpiarHeight 495Width 1215
Cmd Name CmdCaption CerrarHeight 495Width 1215
Formulario
Código
Programa en Ejecución
Ejercicio #3
Ingrese los sueldos del primer cuatrimestre y calcule el sueldo promedio correspondiente a estos primeros cuatro meses
Codificación
Dim Promedio As DoubleDim Enero, Febrero, Marzo, Abril As Double
Private Sub CmdCerrar_Click() Unload MeEnd Sub
Private Sub CmdLimpiar_Click() TxtEnero.Text = "" TxtFebrero.Text = "" TxtMarzo.Text = "" TxtAbril.Text = "" End Sub
Private Sub CmdVerificar_Click() If TxtEnero.Text = "" Or TxtFebrero.Text = "" Or TxtAbril.Text = "" Or TxtMarzo.Text = "" Then MsgBox "Por favor llene todas las casillas", vbExclamation + vbOKOnly, "Error" Else Enero = Val(TxtEnero.Text) Febrero = Val(TxtFebrero.Text) Marzo = Val(TxtMarzo.Text) Abril = Val(TxtAbril.Text) Promedio = (Enero + Febrero + Marzo + Abril) / 4 MsgBox "Su sueldo promedio de cuatro meses es de: " & Promedio, vbExclamation + vbOKOnly, "Promedio" End IfEnd Sub
Tabla de Objetos y propiedades
Control Propiedad ValorFrmEjercicio3 Name FrmEjercicio#3
Caption Calculo del Sueldo PromedioHeight 5490Widtch 7500
Label1 Name Label1Caption Ejercicio 03Height 240Width 1140
Label2 Name Label2Caption Ingrese los sueldos del primer
cuatrimestre y calcule el sueldo promedio
correspondiente a estos primeros cuatro meses
Height 240Width 1140
FraSueldo Name FraSueldoCaption Sueldos del Primer
cuatrimestre ( Enero, Febrero, Marzo y Abril)l
Height 1335Width 6495
TxtEnero Name TxtEneroText VacíoHeight 495Width 1215
TxtFebrero Name TxtFebreroText VacíoHeight 495Width 1215
TxtMarzo Name TxtMarzoText VacíoHeight 495Width 1215
TxtAbril Name TxtAbrilText VacíoHeight 495Width 1215
CmdVerificar Name CmdVerificarCaption VacíoHeight 495Width 1215
CmdLimpiar Name CmdLimpiarCaption VacíoHeight 495Width 1215
CmdCerrar Name CmdCerrarCaption VacíoHeight 495Width 1215
Formulario
Código
Programa en ejecución
Ejercicio #4
Ingrese El sueldo Mensual y los respectivos gastos realizados en los siguientes rubros, Casa, Agua, Luz y Alimentación
Si los gatos son menores o iguales al 50% del sueldo mensual, Desplegar un mensaje que indique que "El monto de los gastos Es Aceptable"
Si los gatos son menores o iguales al 50% del sueldo mensual, Desplegar un mensaje que indique que "El monto de los gastos Es Aceptable"
Código
Dim Sueldo, gastos, mitad, casa, luz, agua, alimentacion As Currency
Private Sub CmdCerrar_Click() Unload MeEnd Sub
Private Sub CmdLimpiar_Click() TxtSueldo.Text = "" TxtCasa.Text = "" TxtLuz.Text = "" TxtAgua.Text = "" TxtAlimentacion.Text = ""End Sub
Private Sub CmdVerificar_Click() If TxtSueldo.Text = "" Or TxtCasa.Text = "" Or TxtLuz.Text = "" Or TxtAgua.Text = "" Or TxtAlimentacion.Text = "" Then MsgBox "Por favor llene todas las casillas", vbCritical + vbOKOnly, "Error" Else Sueldo = Val(TxtSueldo.Text) casa = Val(TxtCasa.Text) luz = Val(TxtLuz.Text) agua = Val(TxtAgua.Text) alimentacion = Val(TxtAlimentacion.Text) gastos = casa + luz + agua + alimentacion mitad = Sueldo / 2 If gastos > mitad Then MsgBox "Alerta haga un reajuste de gastos" Else MsgBox "Sus gastos son aceptables" End If End If End Sub
Tabla de objetos y propiedades
Control Propiedad ValorFrmEjercicio04 Name FrmEjercicio04
Caption Presupuesto de Ingresos e Ingresos Mensual
Height 7470Widch 9345
Label1 Name Label1Caption Ejercicios 04Autosize True
Label2 Name Label2Caption Ingrese El sueldo Mensual y
los respectivos gastos realizados en los siguientes rubros, Casa, Agua, Luz
Autosize TrueLabel8 Name Label8
Caption Si los gatos son menores o iguales al 50% del sueldo mensual, Desplegar un mensaje que indique que "El monto de los gastos Es Aceptable"
Autosize TrueLabel9 Name Label9
Caption Si los gatos son Mayores al 50% del sueldo mensual, Desplegar el siguiente mensaje "Alerta, Realizar un Reajustes a sus gastos"
Autosize TrueLabel7 Name Label7
Caption Sueldo MensualAutosize True
Label3 Name Label3Caption CasaAutosize True
Label4 Name Label4Caption AguaAutosize True
Label5 Name Label5Caption LuzAutosize True
Label6 Name Label6Caption AlimentacionAutosize True
FraSueldos NAME FraSueldoCaption Gastos del MesHeight 1695Widch 6735
TxtCasa Name TxtCasaText CasaHeight 495Widtch 1215
TxtAgua Name TxtAGuaText AguaHeight 495Widtch 1215
TxtLuz Name TxtLuzText LuzHeight 495Widtch 1215
TxAlimentación Name TxtAlimentacionText AlimentaciónHeight 495Widtch 1215
CmdVerificar Name CmdVerificarCaption VerificarHeight 495Width 1215
CmdLimpiar Name CmdLimpiarCaption LimpiarHeight 495Width 1215
CmdCerrar Name CmdCerrarCaption 495Height 495Width 1215
Formulario
Código
Programa en ejecución
Ejercicio #5
Realizar la concatenación de los siguientes datos solicitados al Usuario, siempre y cuando las casillas contengas datos.
Codificación
Dim Nombres, Apellidos As String
Private Sub CmdCerrar_Click() Unload MeEnd Sub
Private Sub CmdLimpiar_Click() TxtEnero.Text = "" TxtFebrero.Text = "" End Sub
Private Sub CmdUnir_Click() If TxtEnero.Text = "" Or TxtFebrero = "" Then MsgBox "Por favor llene todas las casillas", vbCritical + vbOKOnly, "Error" Else Nombres = TxtEnero.Text Apellidos = TxtFebrero.Text MsgBox "Su nombre completo es: " & Nombres & " " & Apellidos, vbExclamation + vbOKOnly, "Hecho" End IfEnd Sub
Tabla de objetos y propiedades
Control Propiedad ValorFrmEjercicio05 Name FrmEjercicio05
Caption Concatenación de DatosHeight 5490Width 7500
Label1 Name Label1Caption Ejercicio05Autosize True
Label2 Name Label2Caption Realizar la concatenacion de
los siguientes datos solicitados al Usuario, siempre y cuando las casillas contengas datos.
Autosize TrueLabel3 Name Label3
Caption NombresAutosize True
Label4 Name Label4Caption ApellidosAutosize True
FraSueldos Name FraSueldosCaption Datos PersonalesHeight 1575Width 6495
Txtnombres Name TxtNombresCaption NombresHeight 495Widtch 1215
TxtApellidos Name TxtApellidosCaption ApellidosHeight 495Widtch 1215
CmdVerificar Name CmdVerificarCaption VerificarHeight 495Widtch 1215
CmdLimpiar Name CmdLimpiarCaption LimpiarHeight 495Widcht 1215
CmdCerrar Name CmdCerrarCaption CerrarHeight 495Widcht 1215
Formulario
Código
Programa en ejecución