Proyecto Visual Basic
Enviado por Aldo Chibamba • 15 de Diciembre de 2017 • Práctica o problema • 1.627 Palabras (7 Páginas) • 262 Visitas
Proyecto Visual Basic
Form1
Private Sub Picture1_Click()
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = Rnd * 300 + 10
ProgressBar1.Value = ProgressBar1.Value + 2
Label1.Caption = "Cargando " & ProgressBar1.Value & "%"
Label2.Caption = "Aldo Josue Chibamba Malaga"
Label3.Caption = "Info"
Label4.Caption = "505"
If ProgressBar1 > 99 Then
Unload Me
Form2.Show
End If
End Sub
Form2
Private Sub Command1_Click()
If Text1.Text = "Aldo" And Text2.Text = "123456" Then
Unload Me
MsgBox "Bienvenido Aldo Josue Chibamba Malaga"
Form3.Show
ElseIf Text1.Text = "Ventas" And Text2.Text = "080799" Then
Unload Me
MsgBox "Bienvenido Vendor Aldo"
Form6.Show
Else
MsgBox "Usurio o Contraseña Incorrecto"
Text1.Text = ""
Text2.Text = ""
End If
End Sub
Private Sub Command2_Click()
If (MsgBox("¿Esta seguro de cancelar inicio de sesion?", vbQuestion + vbYesNo, "Pregunta") = vbYes) Then
End
End If
End Sub
Form3
Private Sub Command1_Click()
On Error GoTo Errores
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
MsgBox "falto un campo de llenar", vbInformation, "Informacion"
Text1.SetFocus
Exit Sub
End If
If PELIAJCM.Recordset.RecordCount <> 0 Then
PELIAJCM.Recordset.MoveFirst
End If
PELIAJCM.Recordset.Find "CLAVE='" & Text1.Text & "'"
With PELIAJCM.Recordset
If .BOF = False And .EOF = False Then
MsgBox "Clave repetida", vbInformation, "Informacion"
Text1.SetFocus
Exit Sub
End If
.AddNew
!CLAVE = Text1.Text
!NOMBRE = Text2.Text
!ANIO = Text3.Text
!GENERO = Text4.Text
!IDIOMA = Text5.Text
!PRECIO = Text6.Text
.Update
MsgBox "Datos Guardados", vbInformation, "Informacion"
End With
Errores:
If Err <> 0 Then
MsgBox "Error Fatal", vbCritical, "Error"
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form4.Show
End Sub
Private Sub Command3_Click()
If (MsgBox("¿Esta seguro de salir?", vbQuestion + vbYesNo, "Pregunta") = vbYes) Then
End
End If
End Sub
Private Sub Command4_Click()
Unload Me
Form5.Show
End Sub
Private Sub Command5_Click()
On Error GoTo Errores
If Text1.Text = "" Then
MsgBox "datos vacios", vbInformation, "Informacion"
Text1.SetFocus
Exit Sub
End If
If PELIAJCM.Recordset.RecordCount <> 0 Then
PELIAJCM.Recordset.MoveFirst
End If
PELIAJCM.Recordset.Find "CLAVE='" & Text1.Text & "'"
With PELIAJCM.Recordset
If .BOF = True And .EOF = False Then
MsgBox "Clave repetida", vbInformation, "Informacion"
Text1.SetFocus
Exit Sub
End If
Text1.Text = !CLAVE
Text2.Text = !NOMBRE
Text3.Text = !ANIO
Text4.Text = !GENERO
Text5.Text = !IDIOMA
Text6.Text = !PRECIO
End With
Text1.SetFocus
Errores:
If Err <> 0 Then
MsgBox "Error Fatal", vbCritical, "Error"
End If
End Sub
Private Sub Command6_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Command7_Click()
If (MsgBox("¿Esta seguro de cerrar sesion?", vbQuestion + vbYesNo, "Pregunta") = vbYes) Then
Unload Me
Form2.Show
End If
End Sub
Private Sub Command8_Click()
Unload Me
Form3.Show
End Sub
Private Sub Form_Load()
Dim PELI As String
On Error GoTo Errores
PELI = App.Path & "\PELISINFO505AJCM.mdb"
PELIAJCM.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & PELI
PELIAJCM.RecordSource = "TBL_DATOS"
PELIAJCM.Refresh
Errores:
If Err.Number <> 0 Then
MsgBox "Error de conexion", vbCritical, "Error BD"
End If
End Sub
Form4
Private Sub Command1_Click()
On Error GoTo Errores
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then
MsgBox "falto un campo de llenar", vbInformation, "Informacion"
...