views:

218

answers:

1

Hi!

I have a form

MyForm : System.Windows.Forms.Form {}

and I need to call

Site.GetService(..)

before user starts using this form.

But it's null in constructor and all loading events I've tried to override. When is the Site not null, please?

A: 

By default, IComponent.Site is set only in the Visual Studio designer. It is used for design-time services within the IDE such as naming the component. Here is an article that talks about how sites are used: Design-Time Integration—Hosts, Containers, and Sites.

Brian