Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

685 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