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
Solved

passing value from child form to parent form "live" and not closing child form

Posted on 2004-10-12
2
170 Views
Last Modified: 2010-05-02
Hi,

I have the following program. On the main form you can search for customers by a button.
I have created a aciveX dll with a class customer and a methode getCustomers. when this methode is called (from the main form) a (child)form is shown with the data for different customers shown in a flexgrid. when I double click on the flexgrid I want to change data on the parent (main) form. The child form should not close so that you can click on an other customer.

I have created the class in an activeX dll because I want to use the same functionality behind other forms.

How can i get the data from the child form to the parent.( I think this is the easy part) How can i trigger the parentform to update the parentform when the flexgrid on the child form is clicked?

Any help would be appreciated.
0
Comment
Question by:Victoria_
2 Comments
 
LVL 18

Accepted Solution

by:
JR2003 earned 250 total points
ID: 12292285
You can raise an event in the ActiveX class by calling a function in the child form which will then be fired in the parent form.

Here's an outine of what you will need to do:
e.g.
In your exposed class define an event

Public Event SelectedCustomer(CustomerName As String, CustomerId As String)

'Also define a function that takes the Customer details as parameters

Friend Function PutCustomer(CustomerName As String, CustomerId As String)

            RaiseEvent SelectedCustomer(CustomerName, CustomerId )

End Function


'Call the PutCustomer function on the double click event on the FlexGrid with the required parameters.


'In the parent form Declared the ActiveX class with events.

Private WithEvents MyClass as cCustomerSelectClass

'Somewhere in the code
Set MyClass = New cCustomerSelectClass

You will then be able to access the event from code as

Private Sub MyClass_SelectedCustomer(CustomerName As String, CustomerId  As String)

    'Do something here wiith the CustomerName and CustomerId  parameters to get them into the parent form.

End Sub
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

829 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