Solved

Calling Public Function form other form

Posted on 2006-11-29
3
140 Views
Last Modified: 2010-04-23
Hi,

   I am having two forms say FormA and FormB, FormA is having Listview and a Public Function say LoadData, to fill ListView with data, I called this function from Form_Load_Event of FormA which load the ListView with data without problem but if I call this Function form FormB it does not do any thing.

I call this function from FormB in following manner:

Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click

     Dim FrmC as New FormA

      FrmC.LoadData()
End Sub


Thanx
0
Comment
Question by:bobbyamor
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 20 total points
ID: 18037828
Right....because you have created a NEW instance of FormA and called its function.  You need a reference to the actual FormA instance that is on your screen.

You need to pass a reference to FormA into FormB when you create it.

Or if you have VB.Net 2005, you can iterate the forms collection to find the right one.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now