Solved

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

Posted on 2004-10-12
2
173 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_
[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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month4 days, 18 hours left to enroll

635 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