How can I access a public function in an open usercontrol from another form (WinForms)
Posted on 2009-04-22
I have a usercontrol (uc_Main) of which an instance is loaded and functions as a "main" page. On this control are a dozen or so lables that show total values of invoices, Accounts Receivable and so on.
These labels are updated when the control loads through a public function called "updateStats".
From this control a button opens a modal form (frmFIN_InvoiceClient.cs) that allows me to create invoices. When invoices are being created, I would need to update the totals on uc_Main to reflect the new activities.
I have tried to do it this way:
private void menuItem6_Click(object sender, EventArgs e)
... create invoices first ...
... then try and run the public function on uc_Main ...
uc_Main uc_Main = new uc_Main();
Which doesn't produce the results I am looking for.
How can I run the updateStats() public function on uc_Main that is currently open?