I am currently running VS2008 and this is the following code I use to populate 2 DataGridView's on my application......
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim strTestConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Game.mdb"
Dim strSQLSelect1 As String = "SELECT * FROM Armor"
Dim strSQLSelect2 As String = "SELECT * FROM Player"
Dim ArmorDataAdapter As New OleDbDataAdapter(strSQLSelect1, strTestConnection)
Dim PlayerDataAdapter As New OleDbDataAdapter(strSQLSelect2, strTestConnection)
Dim TestDataSet As New DataSet()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ArmorDataAdapter.Fill(TestDataSet, "Armor")
PlayerDataAdapter.Fill(TestDataSet, "Player")
DataGridView1.DataSource = TestDataSet
DataGridView1.DataMember = "Armor"
DataGridView2.DataSource = TestDataSet
DataGridView2.DataMember = "Player"
End Sub
End Class
My question is this... I want to add either a textbox and use its textchanged event?
OR Add a textbox and a button, when the user clicks the button the code I want to run will run....
I want to be able to use this textbox to sort through the records in the DGV ....
FOR EXAMPLE If my stored records are JAMES, JASON, JACK
A user types "JA" into the textbox and all the records stay because all the names start with JA
If they go one step further and type "JAM" into the textbox, only JAMES' record will show in the DGV and the rest will be invisible.
when the textbox = Nothing ....... all records return...... How do I do this?
I have seen filters like this created in previous versions, just not sure how to update them.
NOTE: Although the above code populates 2 DGV's, the filter itself, need only apply to one as there will only be one DGV, I was just messing around with a tutorial on how to load 2 DGV's from one dataset I did search the internet for the answer to this, but none quite gave me the answer I was looking for.
Enter your message below
Sign in or Join us (it's free).