Searching Records on Windows Form
I can't seem to find a solution for this anywhere!
Everywhere I've searched on Google always shows me how to do this with a datagrid - but not a form.
I've created a form which correctly displays all my fields in a recordset. I can scroll through them, add new records, delete records, etc. etc. and everything is fine.
I now want to add a Search field to the form so that when the user enters a search string, it automatically searches through the dataset and refreshes the display to display the appropriate search result (i.e. populates the currently open form with the appropriate record).
Any help will be appreciated.
[1683 byte] By [
JEP8979] at [2007-12-24]
Can you specify more details about your problem?
if your RecordSet is linked to the DataSet (datasource) you can update the dataset
with your search result and then refresh the recordset
Hope this can help.........
A bit of background: -
I am using a sql server database and a windows form.
I have the necessary bindingnavigator to scroll through the records, add, delete etc.
When the form loads all records are available to view. I would like to have a search facility which takes you to the specific record(s). I would ideally like all records to still be available to scroll through.
I am looking for the search facility to act in the same way the navigator would, not like a filter.
Hope this gives you a clearer picture. If not, please let me know and I will try and expand
I added a second toolstrip with a label, a text box for the search string, and a button to perform the lookup. As a quick test, I just did the search on the ID field (which is not very user friendly, but worked fine for the test.
I then added the following code to the button click on the toolstrip:
Me.ProductRetrieveList_spBindingSource.Filter = "ProductID=" & ProductIDToolStripTextBox.TextYou would need to change the name of the binding source to our binding source (the same one used by the navigator). You would also need to change the filter to filter to the desired search string.
Hope this gets you close ...
Thanks DeborahK, however I don't seem to have the 'productretievelist' option in my coding.
Alos, I am looking for the records not to be filtered, I would like to be able to Jump to a specific record.
e.g. if you have 100 records in your database and you display each record on your form. Instead of scrolling through the records to get to the one you want I want to be jump to it.
All help appreciated.