I have two textbox - Name & Mobile which i use to filter customer's data in DataGridView1. When i filter the data using NAME field i get perfect results but when i use MOBILE field i want the data should filter after filtering according to NAME field and then according to MOBILE field. For example, i first filter data for all the customers whose Name starts from 'V' using NAME textbox and then i further filter these data on the basis of MOBILE so i should get result of all the customers whose name starts from 'V' and whose Mobile number is as per query in the MOBILE textbox :
My code for Name:
My code for Mobile:Code:Private Sub name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles name.TextChanged CUSTOMERBindingSource.Filter = "name like '" & name.Text & "%'" End Sub
What changes should be made in the second code ?Code:Private Sub mobile_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mobile.TextChanged CUSTOMERBindingSource.Filter = "name like '" & name.Text & "%'" CUSTOMERBindingSource.Filter = String.Format("Convert(Mobile, 'System.String') LIKE '{0}%'", mobile.Text) End Sub![]()




Reply With Quote