Bruce, thank you.
This is the kind of info I've been looking for. :-)
One other question (for now).
When my app runs, it auto-opens an MDIChild (WebForm) that contains a couple
of JPG maps on individual WebBrowser controls. These maps arew "hot-spotted"
by using HTML code. When the user clicks on a section of the map, a MyForm
opens with data for that section.
I have multiple copies of MyForm open (between 2 - 20).
I also have a SummaryFrm open (called from the MainApp menu) that grabs a
couple of variables from each open MyForm and displays and then calculates
and displays summaries.
So far so good.
I need SummaryFrm to iterate thru the open MyForms and run a public method
inside MyForm.
I can see this public method easily enough from WebForm, but not from
SummaryFrm. I understand that SummaryFrm has no direct relationship with
MyForm so how do I get the data specific to each MyForm back into
SummaryFrm?
cheers,
Mark
"Bruce Wood" <br*******@canada.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
>
On Jan 26, 3:30 pm, "Mark Chimes" <markchi...@gmail.comwrote:
>Hi Marc,
I am using...
string someVariable =
Application.OpenForms[i].Controls[j].Controls[k].Text
to gain access to the contents of controls in these forms.
Ugh. That's the nasty way to do it. Much nicer to make properties in
your Form class that return meaningful values and know where to look
them up. For example:
public string CustomerName
{
get { return this.CustomerNameTextBox.Text; }
}
>How do I run a public method of this form? For example, I have a pubic
method called ChangeMap(string strState) that I need to call from the
main
form.
Well, if you're using the OpenForms list, and you're looking for forms
of class MyForm3, you could do this:
MyForm3 f3 = Application.OpenForms[i] as MyForm3;
if (f3 != null)
{
string customerName = f3.CustomerName;
f3.ChangeMap("....");
}
The "as" operation and the "if (f3 != null)" allow for other types of
forms being open, but you want only the MyForm3 type forms.
--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 1841 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!