On Thu, Jun 24, 2010 at 12:11 PM, Anthony <[email protected]> wrote:

>  Isn’t dependency injection just passing an instance to an object?
>
It's about passing dependencies to an object rather than instantiating them
from within the object, thus reducing coupling, creating seams for testing
and making modification easier (sometimes). It also encourages the use of
interfaces rather than implementations which enhances the benefits.

The down side of dependency injection is that you can end up having to do a
whole lot of work to manually create and pass in the dependencies when
building an object graph. IoC containers take care of this for you.

If you are interested (and IMHO you should be) then start out practicing
dependency injection. The benefits should become clear quite quickly, and
not long after that the pain of manually building the object graphs. Not
long after that the use and benefits of IoC containers should become
self-evident.

Cheers
Dave

>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *David Burstin
> *Sent:* Thursday, 24 June 2010 11:28 AM
>
> *To:* ozDotNet
> *Subject:* Re: Get main form instance from usercontrol
>
>
>
> Hi Anthony,
>
>
>
> I use NInject for IoC. I've only just started using it but found reading
> through this <http://wiki.github.com/ninject/ninject/why-use-ninject> to
> be very helpful in explaining what IoC containers are used for and how they
> amke working with dependency chains easy. YMMV.
>
>
>
> Cheers
>
> Dave
>
> On Thu, Jun 24, 2010 at 11:17 AM, Anthony <[email protected]> wrote:
>
> Interesting ..i have no idea what an ioc container is?
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *David Kean
> *Sent:* Thursday, 24 June 2010 10:57 AM
> *To:* ozDotNet
> *Subject:* RE: Get main form instance from usercontrol
>
>
>
> This is why I also use an IoC container – I’m also lazy, and I have it
> worry about finding me the dependencies. ;)
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Anthony
> *Sent:* Wednesday, June 23, 2010 5:50 PM
> *To:* 'ozDotNet'
> *Subject:* RE: Get main form instance from usercontrol
>
>
>
> Agree with you..but was hoping to save some effort setting a property for
> all instances of my control.  I guess i should just add a property and go
> for it..lazy me!
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *David Kean
> *Sent:* Thursday, 24 June 2010 10:41 AM
> *To:* ozDotNet
> *Subject:* RE: Get main form instance from usercontrol
>
>
>
> What are you trying to do? A user control should try and be naive to where
> it’s being hosted – I typically have these communicate to the form hosting
> it by using events and properties.
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Joseph Clark
> *Sent:* Wednesday, June 23, 2010 5:31 PM
> *To:* ozDotNet
> *Subject:* Re: Get main form instance from usercontrol
>
>
>
>
> http://msdn.microsoft.com/en-us/library/system.windows.forms.control.findform.aspxshould
>  work?
>
> On Thu, Jun 24, 2010 at 10:25 AM, Anthony <[email protected]> wrote:
>
> What method do i need to use to the get the main instance  of a form from a
> usercontrol?
>
>
>
> The main form is of type FormMain but how do i access the instance from a
> usercontrol?  If i use me.parent..this would only give the instance of the
> container object. Using vb.net winforms
>
>
>
> Is your website being 
> IntelliXperienced?<http://www.intellixperience.com/signup.aspx>
> regards
> Anthony (*12QWERNB*)
>
> Is your website being IntelliXperienced?
>
>
>
>
>
>
>
>
>

Reply via email to