Solved

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

Posted on 2004-10-12
2
167 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

708 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

16 Experts available now in Live!

Get 1:1 Help Now