Matty
...the Myth Buster
- Local time
- Today, 10:17
- Joined
- Jun 29, 2001
- Messages
- 396
While I’m asking questions, I may as well see if anyone can help me with a problem that I still haven’t solved…
In a class library, I’ve created a Find form that works like the search you’d find in Access (form pops up, you choose the field you want to search and it finds the next record). I’ve created my base Find form in my class and I have the logic pretty much figured out to find the first record. The problem is that I don’t know how to scroll to the found record on the main form properly.
My Find form has a combobox, cboFindBy (field to search) and a textbox to enter the criteria, txtFind. When the popup loads (as modal), it is passed a form parameter (frmMainForm) which is the form the Find was launched from as well as a DataView parameter (dvFindData) that contains the records to search through (in this case, the records behind frmMainForm). The popup then loops through the controls on the passed main form, finding the fields that I’ve flagged as “searchable” and adds them to the cboFindBy combobox.
When the Search button is hit on my popup form, I search though the passed DataView using the criteria entered on the form. I grab the primary key from the first record that I find, and that’s where I don’t know where to go.
If I just wanted to find the first record, I could just save this PK into a public variable and do a bsBindingSource.Find with it on the main form (I think). But what I want to happen is to do a sort of “Find Next” functionality where they can keep clicking Search and it’ll go to the next found record and so on.
So basically I need to trigger a search on the main form whenever my Search button gets clicked, but I need to keep this generic enough so that this form is re-usable. I’d like to use the passed frmMainForm variable, but how?
In a class library, I’ve created a Find form that works like the search you’d find in Access (form pops up, you choose the field you want to search and it finds the next record). I’ve created my base Find form in my class and I have the logic pretty much figured out to find the first record. The problem is that I don’t know how to scroll to the found record on the main form properly.
My Find form has a combobox, cboFindBy (field to search) and a textbox to enter the criteria, txtFind. When the popup loads (as modal), it is passed a form parameter (frmMainForm) which is the form the Find was launched from as well as a DataView parameter (dvFindData) that contains the records to search through (in this case, the records behind frmMainForm). The popup then loops through the controls on the passed main form, finding the fields that I’ve flagged as “searchable” and adds them to the cboFindBy combobox.
When the Search button is hit on my popup form, I search though the passed DataView using the criteria entered on the form. I grab the primary key from the first record that I find, and that’s where I don’t know where to go.
If I just wanted to find the first record, I could just save this PK into a public variable and do a bsBindingSource.Find with it on the main form (I think). But what I want to happen is to do a sort of “Find Next” functionality where they can keep clicking Search and it’ll go to the next found record and so on.
So basically I need to trigger a search on the main form whenever my Search button gets clicked, but I need to keep this generic enough so that this form is re-usable. I’d like to use the passed frmMainForm variable, but how?