Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now