Solved

Calling Public Function form other form

Posted on 2006-11-29
3
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET Textbox input validation 4 63
MYSQL responding very slow 3 48
vb.net deleting excel sheet in workbook 11 30
Create a button class for use in all vb.net apps 5 14
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…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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