Calling Public Function from another form

I have 2 forms. One being a Search form and the other being the Data form.

The Search form is loaded from the Data form where the user conducts their search.

My problem is that after the user finds the particular record they're after and pick it up from the list I need to call a Public function in the data form to load all the data into the data form.

How can I call this function in the data form from the search form?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This code should do what you are looking for. I am assuming that for search form is named SearchForm and your data form is named DataForm.

---------SearchForm code

Public dataForm as DataForm

Private Function loadData()
      Return DataForm.getData()
End Function

---------DataForm code

Private Sub showSearchForm()
      Dim sForm as new SearchForm
      sForm.dataForm = me
End Sub

Public Function getData()
      'Code to get data and return it
End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterErhardAuthor Commented:
Thanks - that did the trick.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.