1 / 63

AbrirWord

AbrirWord. Cambiar Fondo. Acoplable o No Acoplable. Creación de Formularios y cambio de Propiedades. 2 formularios. Nombre: Frmconsulta, FrmListadoLibros. Borderstyle: 2-sizable Caption: Listado, Form1. 5 formularios. Nombre: Prestamos, usuarios y usuariosys, Libros y Ventas

weylin
Télécharger la présentation

AbrirWord

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AbrirWord

  2. Cambiar Fondo

  3. Acoplable o No Acoplable

  4. Creación de Formularios y cambio de Propiedades 2 formularios Nombre: Frmconsulta, FrmListadoLibros. Borderstyle: 2-sizable Caption: Listado, Form1 5 formularios Nombre: Prestamos, usuarios y usuariosys, Libros y Ventas Borderstyle: 2-sizable Caption:Prestamos, usuarios,usuarios 1 formularios Nombre: explorador Borderstyle: 2-sizable Caption:form1

  5. El editor de menus debe quedar de esta manera para establecer los menus de la barra de arriba si queremos mostrar un formulario llamado frmPrincipal, el código se implementa de la siguiente forma: frmPrincipal.Show Utilizando el método show especificaemos en línea de codigo

  6. tabla de botones Sintaxis: MsgBox (mensaje, [Botones], [titulo], [Archivo de ayuda], [Contexto])

  7. Las propiedades modificadas son : Forecolor, backcolor, borderstyle, font, caption, text

  8. marcos

  9. codigo Private Sub btnInhabilita Click() btnVisible.Enabled=False End Sub Private Sub btnhabilita Click() btnVisible.Enabled= True End Sub Private Sub btnVisible Click() btnOculto.Visible=True End Sub Private Sub btnOculto Click() btnOculto.Enabled=False End Sub

  10. botones

  11. If chkPWA.Value = 1 Then MsgBox ("Autor: Microsoft $ 500.00") End If If chkVFP.Value = 1 Then MsgBox ("Autor: Microsoft $ 300.00") End If If chkBD.Value = 1 Then MsgBox ("Autor: Borland $ 500.00") End If If chkVB.Value = 1 Then MsgBox ("Autor: Microsoft $ 600.00") End If

  12. Private Sub opSerfin_Click() txtSerfin = opSerfin.Value txtBancomer.Text = obBancomer.Value txtInverlat = opInverlat.Value End Sub Private Sub opTarjeta_Click() fmeBanco.Enabled = True txtBancomer.Text = obBancomer.Value txtInverlat = opInverlat.Value txtSerfin = opSerfin.Value End Sub Private Sub obBancomer_Click() txtBancomer.Text = obBancomer.Value txtInverlat = opInverlat.Value txtSerfin = opSerfin.Value End Sub Private Sub opEfectivo_Click() fmeBanco.Enabled = False End Sub Private Sub opInverlat_Click() txtInverlat = opInverlat.Value txtBancomer.Text = obBancomer.Value txtSerfin = opSerfin.Value End Sub

  13. Private Sub cmdsalir_Click() End End Sub Private Sub Form_Load() End Sub Private Sub txtrecipiente_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If IsNumeric(txtrecipiente) = True Then txtvaso.SetFocus Else MsgBox "la informacion debe ser numerica" txtrecipiente = "" txtrecipiente.SetFocus End If End If End Sub Private Sub txtvaso_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If IsNumeric(txtvaso) Then If Val(txtvaso) <= Val(txtrecipiente) Then cmdagregar.SetFocus Else MsgBox "el vaso debe ser mas pequeño o igual" txtvaso = "" txtvaso.SetFocus End If Else MsgBox "la informacion debe ser numerica" End If End If End Sub Dim intresultado As Integer Dim intfaltaron As Integer Private Sub cmdagregar_Click() If intresultado = 0 Then intresultado = Abs(Val(txtrecipiente) / Val(txtvaso)) intfaltaron = Abs((intresultado * Val(txtvaso)) - Val(txtrecipiente)) For intinsertar = 0 To intresultado - 1 lstvaso.AddItem txtvaso Next If intresultado * Val(txtvaso) = Val(txtrecipiente) Then MsgBox "El recipiente se lleno en su totalidad con " _ & intresultado & " vasos" Else MsgBox "el recipiente no se lleno en su totalidad con " _ & intresultado & " vasos, hicieron falta " & intfaltaron & _ " litro(s)" End If Else MsgBox "nuevo calculo presiona el boton nuevo calculo" cmdnuevo.SetFocus End If txtElementos = lstvaso.ListCount End Sub Private Sub cmdnuevo_Click() lstvaso.Clear txtvaso = "" txtrecipiente = "" txtrecipiente.SetFocus intresultado = 0 intfaltaron = 0 End Sub

  14. Para crear una lista modificamos la propiedad List del combobox

  15. Private Sub Timer1_Timer() If BarraProgreso.Width < 4215 Then BarraProgreso.Width = BarraProgreso.Width + 100 Else BarraProgreso.Width = 4215 Timer1.Enabled = False 'Deshabilita el tiempo End If End Sub

  16. Dim| Public| Static nombre_variable As tipo Public: Las variables declaradas serán publicas y podrán estar accesibles desde todos los formularios de la aplicación. Para conseguirlo tendremos que declararlas en un módulo de código. Static: Con esta forma de declarar variables conseguiremos que las variables locales no se creen y se destruyan al entrar y salir de los procedimientos donde fueron declaradas sino que se mantenga su valor durante todo el periodo de ejecución de la aplicación. De esta forma a entrar en algún procedimiento las variables recuerdan el valor que tenían cuando se salió de él.

  17. . TIPOS DE VARIABLES

  18. aritmetricos logicos comparacion

  19. test Option Explicit Dim rCorrectas As Integer Dim i As Integer Private Sub cmdResultado_Click() For i = 0 To 2 If Trim(txtP1.Item(i)) = lstRespuestas.List(i) Then rCorrectas = rCorrectas + 1 End If Next txtResultado = rCorrectas rCorrectas = 0 End Sub Private Sub Form_Load() lstRespuestas.AddItem "Load" lstRespuestas.AddItem "if" lstRespuestas.AddItem "Case" End Sub

  20. testsub Option Explicit Dim rCorrectas As Integer Dim i As Integer Private Sub Form_Load() lstRespuestas.AddItem "Load" lstRespuestas.AddItem "if" lstRespuestas.AddItem "Case" End Sub

  21. testsub

  22. testfunction Option Explicit Dim rCorrectas As Integer Dim i As Integer Private Sub cmdResultado_Click() For i = 0 To 2 If Trim(txtP1.Item(i)) = lstRespuestas.List(i) Then rCorrectas = rCorrectas + 1 Beep End If Next txtResultado = rCorrectas txtCalificacion.Text = test(rCorrectas) rCorrectas = 0 End Sub Private Sub Form_Load() lstRespuestas.AddItem "Load" lstRespuestas.AddItem "if" lstRespuestas.AddItem "Case" End Sub

  23. testfunction Public Sub test() Select Case resUsuario Case 0 test = "Muy mal" Case 1 test = "Regular" Case 2 test = "Muy Bien" Case 3 test = "Excelente" End Select End Sub

  24. Public Function ArrayFuncion(ByVal B As Byte) As Byte() Dim x(2) As Byte x(0) = B x(1) = B + B x(2) = B + CByte(200) ArrayFuncion = x End Function Private Sub Form_Load() Dim B As Byte B = CByte(54) Dim I As Integer Dim ReturnArray() As Byte ReturnArray = ArrayFuncion(B) For I = 0 To 2 Debug.Print ("Byte " & I & ": " & ReturnArray(I)) Next I End Sub Private Sub Timer1_Timer() UserControl22.SetFocus End Sub array

  25. Todos los control data están enlazados a la base de datos BDbiblioteca.mdb la cual podemos encontrar en la carpeta de proyecto alumno

  26. Private Sub cmdPrimero_Click() dtaLibro.Recordset.MoveFirst End Sub Private Sub cmdSig_Click() If dtaLibro.Recordset.EOF = True Then cmdSig.Enabled = False Else cmdAnterior.Enabled = True cmdPrimero.Enabled = True dtaLibro.Recordset.MoveNext End If End Sub Private Sub cmdUltimo_Click() dtaLibro.Recordset.MoveLast End Sub Private Sub cmdAnterior_Click() If dtaLibro.Recordset.BOF = True Then cmdAnterior.Enabled = False Else cmdPrimero.Enabled = True cmdSig.Enabled = True dtaLibro.Recordset.MovePrevious End If End Sub

  27. Private Sub cmdBuscar_Click() With dtaLibros .Recordset.FindFirst ("idLibro =" & txtClaveLibro.Text) If .Recordset.NoMatch Then MsgBox (" No es una clave validad ") Exit Sub End If End With End Sub

  28. eliminar Private Sub cmdEliminar_Click() If dtaLibro.Recordset.EOF = False Then dtaLibro.Recordset.Delete End If If dtaLibro.Recordset.EOF = True Then cmdEliminar.Enabled = True End If dtaLibro.Recordset.MoveLast End Sub

More Related