Re: Circular references ?

From: Jason Sobell (iGadget__at_hotmail.com)
Date: 04/07/04


Date: Thu, 8 Apr 2004 08:45:54 +1000

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
>>
>>



Relevant Pages

  • RE: Duplicate name error after copying task/ VS_ISCORRUPT
    ... What you have to do is copy the assemblies that you want to reference ... Dim oApp As New Application, ... Dim oExec As Executable ... ' Get package path ...
    (microsoft.public.sqlserver.dts)
  • Error 713
    ... and include a reference to the Msdbrptr.dll ... This file is listed as Microsoft Data Report Designer v6.0 in the ... Manually include the Msdbrptr.dll file in the Package and ... <windows system>\MSDBRPTR.DLL ...
    (microsoft.public.vb.controls)
  • Re: How to make custom linked cross-references?
    ... If somebody wants the package on CTAN, ... a macro \p@which is intended for providing some ... A reference to section~of this book ... You might wish to take reference to yet another label within ...
    (comp.text.tex)
  • Re: How to make custom linked cross-references?
    ... If somebody wants the package on CTAN, ... a macro \p@which is intended for providing some ... A reference to section~of this book ... You might wish to take reference to yet another label within ...
    (comp.text.tex)