Click here to Skip to main content
14,328,763 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am having multiple forms with Find button provided. The forms i am having are Contacts.vb and Users.vb, i want to use single Find.vb form for both of these forms. I mean whether a user presses Find button from Contacts.vb or Users.vb the same form should be opened with corresponding data that is fetched from database.

I tried using Find.Owner = Me from Users.vb but i don't know how can i determine from Find.vb that who is the owner.

I tried to use that if owner of find form is Users.vb then fetch data from users table and if owner is Contacts.vb then fetch data from Contacts table.
Unfortunately i am not able to perform this task.

Please provide any proper solution or any other suggestion to perform this.
Thanks in Advance
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Though there are so many ways, because of you cannot think of any logic to do it, I will give you a very simple logic.

Create your Find form say(Find.vb)

Create 2 properties, one for Query and one for the Returnedvalue.

In your find form
1. Populate your data using the value in the Query Property.
2. After selection set Returnedvalue property with the seloected value.
3. Then dont drop the form just hide the form.

In your Contacts/Users form after clicking on the find button
1. Create the Find form object.
2. Set the Query Property with relevent query to populate data.
3. Show the form as dialogue.
4. Get the selected value from the Returnedvalue parameter of the Find form object.
5. Dispose the find form.

Thats all.

Now you need to code.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100