BindingSource.Filter more than X year old?

BStephane

New member
Joined
Oct 22, 2014
Messages
1
Programming Experience
Beginner
Hy,
I have a form link to an Access Database using Databinding and Datagridview.
This database contains contacts : Firstnam, Lastname, Gender, Age.

Using a textbox (txtAge) and a button (btnSearch), I want to filter my database.
I write the code below that give me all the contacts which are exactly X years old (X is the value indicated in the TextBox).

VB.NET:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim Requete As String = ""
        Try
            If txtAge.Text.Length > 0 Then
                Requete = " Age like '%" & txtAge.Text & "%'"
            End If

 Me.ContactsIDBindingSource.Filter = Requete
        Catch ex As Exception

        End Try
    End Sub

This code is working but How can I get all the contact which are more than X year old (>= X) (X is the value indicated in the TextBox) ???

I try this code but no success...

VB.NET:
Requete = " Age >=" & txtAge.Text

Please HELP ME!!!!
 
Back
Top