PLease guys, help me with this!

I need the right to filter my dataGridView control. I am already aware of this code;

bindingsource.filter = "ID Like '" & textbox1.text & "%'"

but it only works when you are filtering the records by ID. my problem is how about when more than one field in my database table will be used as a reference for filtering. I want to view all student record based on their Address and Surname (for example)

bindingsource.filter = "Address Like '" & textbox1.text & "%'"
bindingsource.filter = "Surname Like '" & textbox2.text & "%'"

the code does only filter the records by Surname

Anyone?

If my problem is not clear for you, please let me know..

Thanks...

Maybe,

bindingsource.filter = "Address Like '" & textbox1.text & "%' and Surname Like '" & textbox2.text & "%'"

Thanks ADATAPOST. I should try that code when I go back home.

You are an angel...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.