0% found this document useful (0 votes)
56 views6 pages

Conalep 1 Viridiana Huerta García 6101-I 080260314-2 PSP: Rocio Pinto Practica #4

This document contains code for 4 forms (Form1, Form2, Form3, Form4) written in VB.NET. Form1 handles user login validation. Form2 displays buttons to navigate to other forms. Form3 allows adding a data record to a database table and searching the table. Form4 searches the database table and displays the results.

Uploaded by

Viri Garcia
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views6 pages

Conalep 1 Viridiana Huerta García 6101-I 080260314-2 PSP: Rocio Pinto Practica #4

This document contains code for 4 forms (Form1, Form2, Form3, Form4) written in VB.NET. Form1 handles user login validation. Form2 displays buttons to navigate to other forms. Form3 allows adding a data record to a database table and searching the table. Form4 searches the database table and displays the results.

Uploaded by

Viri Garcia
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

CONALEP 1

Viridiana Huerta García

6101-I

080260314-2

PSP: Rocio Pinto

PRACTICA #4
Public Class Form1

Private Sub TextBox2_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub button1_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles M.Click
If (TextBox1.Text = "garcia") Then
MsgBox("Bienvenido")
Form2.Show()
Me.Hide()
Else
MsgBox("Contraseña Incorrecta")
End If
End Sub
End Class
Public Class Form2
Dim dt As New DataTable
Dim cn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:viri6101-I\taller.mdb")
Public fila As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Form3.Show()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button2.Click
cn.Open()
Form4.Show()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button3.Click

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button5.Click

End Sub
End Class
Public Class Form3
Dim dt As New DataTable
Dim cn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:viri6101-I\taller.mdb")
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
form4.show()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button1.Click
cn.open()
Dim GuardarDatos As String = "Insert into
datos(Matricula,engomado,serie,marca,modelo,reparacion)" & "values ('"
& txtmatricula.Text & "','" & Txtengo.Text & "','" & Txtserie.Text &
"','" & Txtmarca.Text & "','" & Txtmodelo.Text & "','" & Txtrepa.Text
& "')"
Dim dataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos,
cn)
dataAdapter.Fill(dt)
MsgBox(" Se agrego el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
cn.close()

End Sub

Private Sub Textmarca_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Txtmarca.TextChanged

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button4.Click
txtmatricula.Text = ""
Txtengo.Text = ""
Txtserie.Text = ""
Txtmarca.Text = ""
Txtmodelo.Text = ""
Txtrepa.Text = ""

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button3.Click
Form2.Show()
End Sub
End Class

Public Class Form4


Dim dt As New DataTable
Dim cn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:viri6101-I\taller.mdb")
Public fila As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim ConsultarDatos As String = "Select * From datos "
Dim dataAdapter As New OleDb.OleDbDataAdapter(ConsultarDatos,
cn)
dataAdapter.Fill(dt)
fila = 0
Form3.txtmatricula.Text = CInt(dt.Rows(fila)("matricula"))
Form3.Txtengo.Text = CInt(dt.Rows(fila)("engomado"))
Form3.Txtserie.Text = CInt(dt.Rows(fila)("serie"))
Form3.Txtmarca.Text = CStr(dt.Rows(fila)("marca"))
Form3.Txtmodelo.Text = CInt(dt.Rows(fila)("modelo"))
Form3.Txtrepa.Text = CStr(dt.Rows(fila)("reparacion"))
MsgBox(" se encontro el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
dataAdapter.Dispose()
cn.Close()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button2.Click
txtmatricula.Text = ""
Txtengo.Text = ""
Txtserie.Text = ""
Txtmarca.Text = ""
Txtmodelo.Text = ""
Txtrepa.Text = ""

End Sub
End Class

You might also like