Jump to content
tiagom91

Filtros Data Grid

Recommended Posts

tiagom91

Boas pessoal,

Alguém me poderia ajudar a criar filtros para o datagrid?

Tentei utilizar este comando

DataGridView1.DataSource = ClientesBindingSource.Filter.Contains(TextBox1.Text)

mas nada feito.

Estou a utilizar o VB 2010.

Obrigada!

Share this post


Link to post
Share on other sites
bioshock

A criar filtros?

Tu queres filtrar a tua DataGridView consoante xpto dados? (por outras palavras, criar uma query específica).

Share this post


Link to post
Share on other sites
tiagom91

Queria que aparece os dados consoaste estou a inserir na textebox.

Tipo ja quase consegui fazer mas falta mudar o nome da tabela do datagrid.

        Dim da As OleDbDataAdapter
        Dim ds As DataSet

        Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\BD1.mdb"

        Dim connection As New OleDbConnection(ConnectionString)
        Dim SQL As String = "SELECT " & TextBox1.Text & " , nome  FROM clientes "
        da = New OleDbDataAdapter(SQL, connection)
        ds = New DataSet
        da.Fill(ds, "Clientes")
        Me.DataGridView1.DataSource = ds.Tables("Clientes")
        connection = Nothing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.