0% found this document useful (0 votes)
109 views

Design Code (Error)

This document defines a class in VB.NET that connects to an Access database, retrieves data from a "bill" table, and displays it in text boxes and list boxes on a form. On form load, it connects to the database, fills a dataset with the "bill" table data, and displays the first record. When the text box value changes, it finds the matching record in the dataset and displays fields from it in other controls.

Uploaded by

arunkn4480
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Design Code (Error)

This document defines a class in VB.NET that connects to an Access database, retrieves data from a "bill" table, and displays it in text boxes and list boxes on a form. On form load, it connects to the database, fills a dataset with the "bill" table data, and displays the first record. When the text box value changes, it finds the matching record in the dataset and displays fields from it in other controls.

Uploaded by

arunkn4480
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Imports System.Data.

OleDb
Imports System.Data
Public Class Form5
Dim dte As New DataSet
Dim ddt As New OleDbDataAdapter
Dim con As New OleDbConnection
Dim i As Integer = 0
Public Sub dis()
Try
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\Arun\My Documents\bil.mdb")
con.Open()
ddt = New Data.OleDb.OleDbDataAdapter("select * from bill", con)
dte = New DataSet
ddt.Fill(dte)
Catch ex As Exception
MsgBox("error1")
MsgBox(ex.ToString)
End Try
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles
LinkLabel1.LinkClicked
Form6.Show()
End Sub

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


System.EventArgs) Handles MyBase.Load
Call dis()
TextBox1.Text = dte.Tables(0).Rows(i)(0)
Timer1.Enabled = True
TextBox1.Text = ""
End Sub

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


System.EventArgs) Handles Timer1.Tick
Label9.Text = Date.Now
End Sub

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


As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles
LinkLabel2.LinkClicked

End Sub

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


System.EventArgs) Handles Button2.Click

End Sub

Private Sub TextBox1_TabIndexChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles TextBox1.TabIndexChanged
Try
dte.Tables(0).PrimaryKey = New DataColumn()
{dte.Tables(0).Columns("cod")}
Dim row As DataRow
row = dte.Tables(0).Rows.Find(TextBox1.Text)
ListBox1.Text = row("cod")
ListBox2.Text = row("nam")
ListBox3.Text = row("prc")
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Class

You might also like