Taller

15
Programacion de software Aprendiz Arnomis García Taller APLICAR CONTROLES Y ESTRUCTURAS BÁSICAS DE PROGRAMACIÓN DE UN LENGUAJE ORIENTADO A EVENTOS DE ACUERDO CON EL PROBLEMA A SOLUCIONAR.

description

sena

Transcript of Taller

Programacion de software

Aprendiz

Arnomis García

Taller

APLICAR CONTROLES Y ESTRUCTURAS BÁSICAS

DE PROGRAMACIÓN DE UN LENGUAJE

ORIENTADO A EVENTOS DE ACUERDO CON EL

PROBLEMA A SOLUCIONAR.

INICIO

Iniciamos el programa con la barra de

progreso.

Código: barra de progreso

Public Class FrmBienvenida Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Value = ProgressBar1.Value + 2 Label4.Text = ProgressBar1.Value & "%" If ProgressBar1.Value = 100 Then Timer1.Enabled = False Me.Hide() FrmClave.Show() End If End Sub End Class

SIGUIENTE FORMULARIO

En este formulario ingresare mi cuenta de usuario.

Codigo: clave

Public Class FrmClave Private Sub FrmClave_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub ButtonSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSalir.Click If MsgBox("Usted desea salir de la aplicacion ? ", vbQuestion + vbYesNo, "Pregunta") = vbYes Then End End If End Sub Private Sub ButtonContinuar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonContinuar.Click Dim Usuario As String Dim Contraseña As String Usuario = "Arnomis Garcia" Contraseña = "Garcia" If TextBox1.Text = Usuario And TextBox2.Text = Contraseña Then Me.Hide() FrmMenu.Show() ElseIf TextBox1.Text = "" Then MsgBox("Por favor ingrese su cuenta de usuario", MsgBoxStyle.Critical, "Error") End If End Sub End Class

Luego de haber ingresado, la cuenta de

usuario de forma correcta, nos enviara al

siguiente formulario o ventana.

Que es el formulario menú!

Si ingreso a la opción de tienda, me

aparecerá el siguiente formulario o ventana

Codigo: Formulario tienda.

Public Class FrmTienda Private Sub FrmTienda_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub RadioButton3M_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnM.CheckedChanged TxtDescuento.Text = Val(TxtBruto.Text) * 0.1 End Sub Private Sub rbtnImation_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnImation.CheckedChanged TxtDescuento.Text = Val(TxtBruto.Text) * 0.2 End Sub Private Sub rbtnNcr_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnNcr.CheckedChanged TxtDescuento.Text = Val(TxtBruto.Text) * 0.15

End Sub Private Sub rbtnSony_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnSony.CheckedChanged TxtDescuento.Text = Val(TxtBruto.Text) * 0.3 End Sub Private Sub ButtonCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalcular.Click TxtBruto.Text = Val(TxtVenta.Text) * (TxtProducto.Text) TxtNeto.Text = Val(TxtBruto.Text) - Val(TxtDescuento.Text) End Sub Private Sub ButtonLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLimpiar.Click TxtVenta.Text = "" : TxtProducto.Text = "" TxtBruto.Text = "" : TxtDescuento.Text = "" TxtVenta.Focus() : TxtNeto.Text = "" rbtnM.Checked = False rbtnImation.Checked = False rbtnNcr.Checked = False rbtnSony.Checked = False End Sub Private Sub ButtonSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSalir.Click If MsgBox("Usted desea salir de la aplicacion ? ", vbQuestion + vbYesNo, "Pregunta") = vbYes Then End End If End Sub Private Sub ButtonRetornar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRetornar.Click Me.Hide() FrmMenu.Show() End Sub End Class

Si ingreso a la opción de propina, me aparecerá el siguiente formulario o ventana.

Aquí está su respetivo código

Private Sub FrmPropina_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click If MsgBox("Usted desea salir de la aplicacion ? ", vbQuestion + vbYesNo, "Pregunta") = vbYes Then End End If End Sub

Private Sub btnLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLimpiar.Click txtEdad.Text = "" : txtCondicion.Text = "" txtEdad.Text = "" : txtComportamiento.Text = "" txtEdad.Text = "" : txtPropina.Text = "" txtEdad.Focus() End Sub Private Sub btnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcular.Click If txtEdad.Text >= 2 And txtEdad.Text < 15 Then txtComportamiento.Text = ("Bueno") txtPropina.Text = ("28.50") txtCondicion.Text = ("Niño") ElseIf txtEdad.Text >= 15 And txtEdad.Text <= 25 Then txtComportamiento.Text = ("Regular") txtPropina.Text = ("45.00") txtCondicion.Text = ("Joven") ElseIf txtEdad.Text > 26 Then txtComportamiento.Text = ("Malo") txtPropina.Text = ("00.00") txtCondicion.Text = ("Adulto") End If End Sub Private Sub btnRestaurar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestaurar.Click Me.Hide() FrmMenu.Show() End Sub End Class

Si ingreso a la opción de finanzas, me

aparecerá el siguiente formulario o ventana.

Código: de la opción finanzas.

Public Class FrmFinanzas Private Sub FrmFinanzas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click If MsgBox("Usted desea salir de la aplicacion ? ", vbQuestion + vbYesNo, "Pregunta") = vbYes Then End End If

End Sub Private Sub btnRetornar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRetornar.Click Me.Hide() FrmMenu.Show() End Sub Private Sub btnLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLimpiar.Click txtCompra.Text = "" : txtCuota.Text = "" txtCompra.Text = "" : txtLetras.Text = "" txtCompra.Text = "" : txtInteres.Text = "" txtCompra.Text = "" : txtTotalPagar.Text = "" txtCompra.Text = "" : ComboBox1.Text = "Tipo De Financiamiento" txtCompra.Focus() rbtnLetras2.Checked = False : rbtnLetras4.Checked = False rbtnLetras6.Checked = False : rbtnCuota35.Checked = False rbtnCuota50.Checked = False : rbtnCuota60.Checked = False rbtnInteres5.Checked = False : rbtnInteres10.Checked = False rbtnCuota50.Checked = False : rbtnInteres15.Checked = False rbtnLetras2.Focus() End Sub Private Sub btnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) txtTotalPagar.Text = Val(txtLetras.Text) + Val(txtInteres.Text) + Val(txtCuota.Text) End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged If ComboBox1.SelectedItem = "Tipo Financiamiento" Then txtCompra.Text = "" : txtCuota.Text = "" txtCompra.Text = "" : txtLetras.Text = "" txtCompra.Text = "" : txtInteres.Text = "" txtCompra.Text = "" : txtTotalPagar.Text = "" txtCompra.Focus() rbtnLetras2.Checked = False : rbtnLetras4.Checked = False rbtnLetras6.Checked = False : rbtnCuota35.Checked = False rbtnCuota50.Checked = False : rbtnCuota60.Checked = False rbtnInteres5.Checked = False : rbtnInteres10.Checked = False rbtnCuota50.Checked = False : rbtnInteres15.Checked = False rbtnLetras2.Focus() Else If ComboBox1.SelectedItem = "1" Then txtLetras.Text = Val(txtCompra.Text) / 2 txtInteres.Text = Val(txtCompra.Text) * 0.05 txtCuota.Text = Val(txtCompra.Text) * 0.6

rbtnLetras2.Select() rbtnInteres5.Select() rbtnCuota60.Select() txtTotalPagar.Text = Val(txtLetras.Text) + Val(txtInteres.Text) + Val(txtCuota.Text) ElseIf ComboBox1.SelectedItem = "2" Then txtLetras.Text = Val(txtCompra.Text) / 4 txtInteres.Text = Val(txtCompra.Text) * 0.01 txtCuota.Text = Val(txtCompra.Text) * 0.5 rbtnLetras4.Select() rbtnInteres10.Select() rbtnCuota50.Select() txtTotalPagar.Text = Val(txtLetras.Text) + Val(txtInteres.Text) + Val(txtCuota.Text) ElseIf ComboBox1.SelectedItem = "3" Then txtLetras.Text = Val(txtCompra.Text) / 6 txtInteres.Text = Val(txtCompra.Text) * 0.15 txtCuota.Text = Val(txtCompra.Text) * 0.35 rbtnLetras6.Select() rbtnInteres15.Select() rbtnCuota35.Select() txtTotalPagar.Text = Val(txtLetras.Text) + Val(txtInteres.Text) + Val(txtCuota.Text) End If End If End Sub Private Sub txtLetras_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLetras.TextChanged txtLetras.Focus() End Sub End Class

O si decides salir te aparecerá este aviso o mensaje.

Codigo: de la opción salir.

Public Class FrmMenu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Hide() FrmTienda.Show() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If MsgBox("Usted desea salir de la aplicacion ? ", vbQuestion + vbYesNo, "Pregunta") = vbYes Then End

End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Hide() FrmPropina.Show() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Hide() FrmFinanzas.Show() End Sub Private Sub FrmMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

FIN DE LA PRESENTACION. *-*