ReportsNerd
Active member
- Joined
- Nov 24, 2012
- Messages
- 31
- Programming Experience
- 3-5
Hi, my windows form has a tab control. The code below to search for a person by name is working great. However, Im not sure how to do the next part of my form. I need another tab that just has a data grid view. The grid will be sourced from a different table than what I have in my code below, however, the tables link on a field called File_No. The grid will just have a few columns from a table called Trans (transactions). So, after I look up a person, I will be able to see all their transactions. Help/suggestions appreciated. Thanks.
VB.NET:
Public Class Menu
Dim mySearchString As String
Dim myConnectionString As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\TestDB1.accdb'")
Dim daDebtors As New OleDb.OleDbDataAdapter("Select * From DEBTOR ORDER By NAME1", myConnectionString)
Dim myDataSet As New DataSet
Dim myBindingSource As BindingSource
Private Sub Menu_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
daDebtors.Fill(myDataSet, "Debtors")
myBindingSource = New BindingSource(myDataSet, "Debtors")
End Sub
Private Sub BtnSeek_Click(sender As System.Object, e As System.EventArgs) Handles BtnSeek.Click
mySearchString = InputBox("Name:", "Search", "Anderson")
DisplaySearchResults()
End Sub
Private Sub DisplaySearchResults()
txtName1.DataBindings.Clear()
With txtName1.DataBindings.Add("Text", myBindingSource, "NAME1")
End With
myBindingSource.Filter = "Name1 Like '" & mySearchString & "%'"
End Sub