Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Datagridview sorting

$
0
0
Hi

using this code i am able to load excel .xlsm into a datagridview but how would i use a textchaged event on textbox1.text to display only rows that contain what is in the textbox

thanks

Code:

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

        Dim con As OleDbConnection
        Dim str As String
        Dim cmd As OleDbCommand
        Dim da As OleDbDataAdapter
        Dim table As DataTable = New DataTable()

        con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\test\jobcardreg.xlsm;Extended Properties=""Excel 12.0 Macro;HDR=YES"";") '
        str = "Select * From [Sheet1$]"
        cmd = New OleDbCommand(str, con)
        da = New OleDbDataAdapter(cmd)
        con.Open()
        da.Fill(table)
        Me.DataGridView1.DataSource = table

    End Sub


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>