By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

Iterate through non-ui controls(IContainer components)

P: n/a
D2
Hi,

I need to find all the non-ui controls like errorproviders that have
been dropped in the form. Unlike form.controls property, I dont see
any collection that maintains all the non-ui controls dropped in the
form.

After scanning various posts on the newsgroups, I came to know that
these are maintained in the following member variable (declared in the
designer file):

private System.ComponentModel.IContainer components = null;

However, in my case this is always null.

I'm just wondering if anyone has an idea about where I can find non-ui
controls at runtime?

Thanks,
D2

Apr 3 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 3 Apr, 08:21, "D2" <dhap...@gmail.comwrote:
Hi,

I need to find all the non-ui controls like errorproviders that have
been dropped in the form. Unlike form.controls property, I dont see
any collection that maintains all the non-ui controls dropped in the
form.

After scanning various posts on the newsgroups, I came to know that
these are maintained in the following member variable (declared in the
designer file):

private System.ComponentModel.IContainer components = null;

However, in my case this is always null.

I'm just wondering if anyone has an idea about where I can find non-ui
controls at runtime?

Thanks,
D2
I just dropped a notifyIcon on a form and put this in a button.

foreach(System.ComponentModel.IComponent c in
this.components.Components)
{
Console.WriteLine(c.ToString());
}

The output was:

[System.Windows.Forms.NotifyIcon]
Apr 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.