Hello everyone!
I am new to VB.Net and I am actually developing a simple POS system. I am using visual studio 2010 and Access 2007.
I created a form where the user can search the database and view the invoice details by entering the invoice id in a textbox. The result is displayed in a datagridview. If there is only one item recorded for the invoice, the result is fine. The problem is that if there are more than one item, I get many results like it is duplicated.
The database is PS and the table is SalesInvoice.
The code is below:
Dim TA As New PSDataSetTableAdapters.SalesInvoiceTableAdapter
Dim TBL = TA.GetDataByID(TextBox1.Text)
Dim RW As PSDataSet.SalesInvoiceRow = TBL.Rows(0)
Dim I As Integer
For I = 0 To TBL.Rows.Count - 1
If TBL.Rows(I).Item(0) = TextBox1.Text Then
SalesInvoiceDataGridView.Rows.Add(RW.InvoiceID, RW.InvoiceDate, RW.ItemName, RW.Description, RW.Price, RW.Quantity, RW.Amount, RW.InvoiceTotal)
End If
Next
Any help will be much appreciated please.
Thanks a lot.