Re: Circular references ?
From: Dave S (dave_xxx70_at_hotmail.com)
Date: 04/07/04
- Next message: Dave S: "Re: Circular references ?"
- Previous message: Lisa Jones: "Looking for Appointment Active X"
- In reply to: Jason Sobell: "Re: Circular references ?"
- Next in thread: Jason Sobell: "Re: Circular references ?"
- Reply: Jason Sobell: "Re: Circular references ?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 07 Apr 2004 22:56:05 GMT
Jason,
Not sure I understand that one but I can try and look into raising events.
Any code examples of this anywhere ?
Thanks
Dave
"Jason Sobell" <iGadget_@hotmail.com> wrote in message
news:70ds7tcggrn2.1cfdlkstq2s0j.dlg@40tude.net...
> You can't directly call from B to A, but you can pass back events with the
> package as a parameter, and this is the standard approach to your original
> problem.
> MyHandler simply raises the event without requiring intimate knowledge
> (i.e. dependency) on project B.
>
> This is not a VB.Net specific issue. It applies to all OO languages. Java
> uses interfaces or events to avoid the issue, and you can do the same in
> VB.
>
> Cheers,
> Jason
>
> On Wed, 07 Apr 2004 22:09:35 GMT, Dave S wrote:
> > Erik,
> >
> > Thanks for this, I just wanted to confirm that it's not possible to do
it
> > with just 2 projects.
> > I tried moving my object into another project (so it's sort of an
interface
> > project) and then each of the other projects can reference that project
> > without causing the circular reference problem.
> > I just thought it was a bit messy when in Java you could easily do this
> > without a middleman package containing the object you want to pass
between
> > the classes.
> > At least I know that it wasn't something I'd missed out when declaring
the 2
> > projects initially.
> > Will have to remember this one in future (I've been struggling with this
all
> > afternoon)
> >
> > Dave
> >
> >
> >
> >
> > "Erik Frey" <eriksjunk@hotmail.com> wrote in message
> > news:uCVltrOHEHA.3556@TK2MSFTNGP10.phx.gbl...
> >> "Dave S" <dave_xxx70@hotmail.com> wrote in message
> >> news:ac629e82aab3c366fe2c0c20e78b5eee@news.teranews.com...
> >>> Anyone know how to get round the problem of circular references in
> > VB.NET
> >>> (sorry I'm a .NET newbie).
> >>> I create one project which has 2 classes in it, MyHandler and
MyObject.
> >>> MyHandler just needs to call another class in a different project and
> > pass
> >> a
> >>> parameter of type MyObject to it.
> >>> So the class in the different project needs to import the first
project
> >>> namespace so it know what MyObject is.
> >>> The MyHandler class needs to import the second project namespace so it
> > can
> >>> call the class in the second project.
> >>
> >> Typically this is adressed by creating a third project that contains
your
> >> business types in it.
> >>
> >> Then have your other two projects refer to this new project, to have
> > access
> >> to the common type (so in your case, put MyObject in the third
project).
> >>
> >> Also, keep in mind that even if you have three projects in a solution,
you
> >> still have to add the project references manually (right click on
> >> References - > Add References -> Projects tab)
> >>
> >> Erik
> >>
> >>
- Next message: Dave S: "Re: Circular references ?"
- Previous message: Lisa Jones: "Looking for Appointment Active X"
- In reply to: Jason Sobell: "Re: Circular references ?"
- Next in thread: Jason Sobell: "Re: Circular references ?"
- Reply: Jason Sobell: "Re: Circular references ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|