TECNOLOGÍA E INFORMÁTICA

Un cordial saludo para todos los chicos y chicas del Área de Tecnología e Informática de los grados séptimo a Undécimo de la Jornada Mañana en la Institución Educativa San Pedro Claver de Puerto Boyacá. En este pequeño espacio encontraran en Plan de área de la asignatura y la teoría vista en clase presencial para reforzar lo visto en ella.


CODIGO PARA LOS BOTONES NUEVO-EDITAR-ELIMINAR Y GUARDAR

 Private Sub cmdguardar_Click()

Adodc1.Recordset.Update
habilitarbotones
cmdguardar.Enabled = False
inhabilitarcajas
End Sub

Private Sub cmdnuevo_Click()
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
Adodc1.Recordset.AddNew
txtnit.SetFocus
End Sub

Private Sub cmdeditar_Click()
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
txtnit.SetFocus
End Sub

Private Sub cmdeliminar_Click()
Dim r As Integer
On Error GoTo RutinaDeError
r = MsgBox("¿Desea eliminar el registro?", vbYesNo, "Atención")
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
   Adodc1.Recordset.MoveLast
End If
Exit Sub
RutinaDeError:
 r = MsgBox(Error, vbOKOnly, "Se ha producido un error: ")
 Adodc1.Recordset.CancelUpdate
End Sub


Private Sub inhabilitarcajas()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is TextBox Then
      Controls(n).Enabled = False
   End If
   Next n
End Sub

Private Sub habilitarcajas()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is TextBox Then
      Controls(n).Enabled = True
   End If
   Next n
End Sub

Private Sub inhabilitarbotones()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is CommandButton Then
      Controls(n).Enabled = False
   End If
   Next n
End Sub

Private Sub habilitarbotones()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is CommandButton Then
      Controls(n).Enabled = True
   End If
   Next n
End Sub


Private Sub inhabilitarcombobox()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is combobox Then
      Controls(n).Enabled = False
   End If
   Next n
End Sub

Private Sub habilitarcombobox()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is combobox Then
      Controls(n).Enabled = True
   End If
   Next n
End Sub


Private Sub inhabilitardtpicker()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is DtPicker Then
      Controls(n).Enabled = False
   End If
   Next n
End Sub

Private Sub habilitarDtPicker()
   Dim n As Integer
   For n = 0 To Controls.Count - 1
   If TypeOf Controls(n) Is DtPicker Then
      Controls(n).Enabled = True
   End If
   Next n
End Sub

No hay comentarios:

Publicar un comentario

No dejes de comentar!!!