Eddi8 0 Newbie Poster

Hello everyone….

Can someone help me? Please.

I have got a form with listview connecting access database.
Some how I have managed to call the data to the form. As you can see the code below. It will open all the data to listview. And add the price total to a textbox.


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ListView1.View = View.Details

ListView1.Columns.Add("ProductNumber", 140, HorizontalAlignment.Left)
ListView1.Columns.Add("Decription", 170, HorizontalAlignment.Left)
ListView1.Columns.Add("Qty", 50, HorizontalAlignment.Left)
ListView1.Columns.Add("Price", 70, HorizontalAlignment.Left)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Data.mdb;")

'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from tblProduct", cn)
dr = cmd.ExecuteReader


While dr.Read()


ListView1.Items.Add(dr(0))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(dr(1))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(dr(2))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(dr(3))

' Add sum of price column ----------------------------------------
Dim intIndex As Integer
Dim db1subtotal As Double
Dim db1price As Double
Dim strprice As String
Dim strNPrice As String


For intIndex = 0 To ListView1.Items.Count - 1
strprice = ListView1.Items(intIndex).SubItems(3).Text

db1price = Double.Parse(strprice)

db1subtotal += db1price
TextBox5.Text = CStr(db1subtotal)
Next intIndex


End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class


What I need is , Have a textbox where I can enter the “productNumber” and view the details of that particular productNumber in the listview . with a searchButton.
Any idea ? Please.
Thank you.
Eddi.