This document contains the code for a form in a library management application. It loads data from a database into a datatable, displays the initial row of data in textboxes, and includes buttons to search by client code, navigate between rows, and exit the form. The search button loops through the datatable rows to find a match on the client code field entered by the user, and the navigation buttons increment or decrement the row index variable to display the next or previous row of data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
55 views2 pages
Codigo de Base de Datos Accses
This document contains the code for a form in a library management application. It loads data from a database into a datatable, displays the initial row of data in textboxes, and includes buttons to search by client code, navigate between rows, and exit the form. The search button loops through the datatable rows to find a match on the client code field entered by the user, and the navigation buttons increment or decrement the row index variable to display the next or previous row of data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Public Class frmbiblioteca
Dim dt As New DataTable
Dim intFila As Integer = 0
Private Sub frmbiblioteca_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load Dim strConexion As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source = base de datos Banco.mdb" Dim strSQL As String = "SELECT * FROM Cuenta" Dim dataAdapter As New OleDb.OleDbDataAdapter(strSQL, strConexion) dataAdapter.Fill(dt) dataAdapter.Dispose() ActualizaTexto() End Sub Private Sub ActualizaTexto() n1.Text = CStr(dt.Rows(intFila)("Cod_Cliente")) n2.Text = CStr(dt.Rows(intFila)("Cod_Cuenta")) n3.Text = CStr(dt.Rows(intFila)("Monto")) n4.Text = CStr(dt.Rows(intFila)("Tipo_cuenta")) n5.Text = CStr(dt.Rows(intFila)("Valor_monetario"))
End Sub
Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnbuscar.Click Dim strBusca As String Dim Encontrado As Boolean = False Dim i As Integer strBusca = CStr(InputBox("Escribe el nombre del libro a buscar")) For i = 0 To dt.Rows.Count - 1 If CStr(dt.Rows(1)("Cod_Cliente")) = strBusca Then Encontrado = True intFila = i ActualizaTexto() End If Next If Not Encontrado Then MsgBox("no se encontro nada" & strBusca) End If End Sub
Private Sub btnanterior_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnanterior.Click If intFila > 0 Then intFila -= 1 ActualizaTexto()
End If End Sub
Private Sub btnsiguiente_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnsiguiente.Click If intFila < dt.Rows.Count - 1 Then intFila += 1 ActualizaTexto() End If End Sub Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click End End Sub End Class