Link to home
Start Free TrialLog in
Avatar of awu25
awu25

asked on

C# Calling a method in another form

I have two windows forms, FormPurchaseHistory and FormCustomer. FormPurchaseHistory opens up FormCustomer which displays a list of Customers in a DataGridView control. User clicks on a cell to select a customer and FormCustomer passes the CustomerID to FormPurchaseHistory and FormCustomer closes. There is a method in FormPurchaseHistoy I need to call after FormCustomer passes CustomerID to FormPurchaseHistory to retrieve purchase history by the customer. How do I fire that method?

I am using a static variable in a Module to pass value from FormCustomer to FormPurchaseHistory.
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

can you show us the code, in form FormPurchaseHistory, which opens FormCustomer ?

I would make the selected CustomerID a Public Property of FormCustomer .  I would also show FormCustomer  as a MODAL form, and when the form is closed, read the CustomerID property, and then use that value to retrieve the Customer History for the Selected customer.

AW
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial