Multiple References and Object Instantiation??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles A. Lackman

    #1

    Multiple References and Object Instantiation??

    I am working on a application that has many custom made dlls. Actually, for
    this app each dll is a different form. I am able, with no problem to
    reference and instantiate them to use their public properties and methods
    with no problem. But, if one dll is trying to access another dll's
    properties (this does not work very good) the project tries to copy the dll
    to the directory which already contains the dll and the app will not
    compile. I have tried different ways to work around this, ie.

    Create a Class that instantiates all the forms from the dlls and reference
    the Class from whatever needs them. I can reference them just fine but
    cannot instantiate anything. Basically I am referencing a reference from a
    reference.

    Is there a way to Globally include all the dll's in the project using a
    config file or something so that once the dll is referenced, it is
    accessible by everything that is referenced from the Main App and Eachother?

    I don't believe this is very efficient and would greatly appreciate any
    suggestions, on better ways to accomplish this. The basic plan is to have
    all the forms independant of the Main App so that if a single form is
    changed all that is needed is to updated is the corresponding dll.

    Thanks,

    Chuck



  • Sijin Joseph

    #2
    Re: Multiple References and Object Instantiation??

    Well basically what you are doing is creating a plugin architecture for
    your application. What you need to do in this case is to facilitate
    communication between the plugin forms using Interfaces. The interface
    will be common and you will be passing a reference to the interface
    between the forms rather than passing the actual form objects.

    check out these articles on CodeProject about Plugin architectures






    Let me know if you need further help.

    Sijin Joseph





    Charles A. Lackman wrote:[color=blue]
    > I am working on a application that has many custom made dlls. Actually, for
    > this app each dll is a different form. I am able, with no problem to
    > reference and instantiate them to use their public properties and methods
    > with no problem. But, if one dll is trying to access another dll's
    > properties (this does not work very good) the project tries to copy the dll
    > to the directory which already contains the dll and the app will not
    > compile. I have tried different ways to work around this, ie.
    >
    > Create a Class that instantiates all the forms from the dlls and reference
    > the Class from whatever needs them. I can reference them just fine but
    > cannot instantiate anything. Basically I am referencing a reference from a
    > reference.
    >
    > Is there a way to Globally include all the dll's in the project using a
    > config file or something so that once the dll is referenced, it is
    > accessible by everything that is referenced from the Main App and Eachother?
    >
    > I don't believe this is very efficient and would greatly appreciate any
    > suggestions, on better ways to accomplish this. The basic plan is to have
    > all the forms independant of the Main App so that if a single form is
    > changed all that is needed is to updated is the corresponding dll.
    >
    > Thanks,
    >
    > Chuck
    >
    >
    >[/color]

    Comment

    • Charles A. Lackman

      #3
      Re: Multiple References and Object Instantiation??

      Hello,

      Thank you for your help. I still have to problems. I will Domonstrate what
      I am experiencing:

      (Main App.exe) ->instantiates as mdiChild->(Customer.Dl l)->sends populated
      Dataset to - is also a mdiChild to Main App.exe->(Activity.Dl l)

      Information is also sent to (Contract.Dll) which is also a mdiChild of Main
      App - from both Customer.Dll and Activity.Dll

      In the Main Application I was able to make a reference to all the forms (The
      Dlls) and instantiate them and have them displayed as mdiChildren, which
      works fine. I can send a dataset from the Main App to the Dlls without
      problems. The real problem is sending the modified dataset back to the main
      app when the form (Dll) has lost focus. Forms (Dlls) are not closed they
      are simply hidden. As you can see, the problem is referecing the
      Activity.Dll from both the Main App.exe and the Customer.Dll.

      The Articles you sent gave me some good ideas, but they are hard for me to
      read because they are not in VB.NET. Sorry, anyway, when the Activity Form
      looses focus, how do I make the form send a value to the Main App.

      In the Main App Load Event I :

      Activity.MdiPar ent = Me
      Activity.Show()

      The code continues to run using show (cannot use showdialog with mdiParent),
      so how would I send a value back to the Main App when the LostFocus event is
      fired in the Activity Form?

      Could I implement an interface that handles the Activity LostFocus Event?
      but if so, how would I determine when the event was fired from the Main App?

      Thank You,
      Chuck


      "Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
      news:OfQ%23iaPh EHA.704@TK2MSFT NGP09.phx.gbl.. .[color=blue]
      > Well basically what you are doing is creating a plugin architecture for
      > your application. What you need to do in this case is to facilitate
      > communication between the plugin forms using Interfaces. The interface
      > will be common and you will be passing a reference to the interface
      > between the forms rather than passing the actual form objects.
      >
      > check out these articles on CodeProject about Plugin architectures
      >
      > http://www.codeproject.com/csharp/C_...chitecture.asp
      > http://www.codeproject.com/csharp/pluginmanager.asp
      > http://www.codeproject.com/csharp/PluginsInCSharp.asp
      > http://www.codeproject.com/dotnet/SM...dinArticle.asp
      >
      > Let me know if you need further help.
      >
      > Sijin Joseph
      > http://www.indiangeek.net
      > http://weblogs.asp.net/sjoseph
      >
      >
      >
      > Charles A. Lackman wrote:[color=green]
      > > I am working on a application that has many custom made dlls. Actually,[/color][/color]
      for[color=blue][color=green]
      > > this app each dll is a different form. I am able, with no problem to
      > > reference and instantiate them to use their public properties and[/color][/color]
      methods[color=blue][color=green]
      > > with no problem. But, if one dll is trying to access another dll's
      > > properties (this does not work very good) the project tries to copy the[/color][/color]
      dll[color=blue][color=green]
      > > to the directory which already contains the dll and the app will not
      > > compile. I have tried different ways to work around this, ie.
      > >
      > > Create a Class that instantiates all the forms from the dlls and[/color][/color]
      reference[color=blue][color=green]
      > > the Class from whatever needs them. I can reference them just fine but
      > > cannot instantiate anything. Basically I am referencing a reference[/color][/color]
      from a[color=blue][color=green]
      > > reference.
      > >
      > > Is there a way to Globally include all the dll's in the project using a
      > > config file or something so that once the dll is referenced, it is
      > > accessible by everything that is referenced from the Main App and[/color][/color]
      Eachother?[color=blue][color=green]
      > >
      > > I don't believe this is very efficient and would greatly appreciate any
      > > suggestions, on better ways to accomplish this. The basic plan is to[/color][/color]
      have[color=blue][color=green]
      > > all the forms independant of the Main App so that if a single form is
      > > changed all that is needed is to updated is the corresponding dll.
      > >
      > > Thanks,
      > >
      > > Chuck
      > >
      > >
      > >[/color][/color]


      Comment

      • Sijin Joseph

        #4
        Re: Multiple References and Object Instantiation??

        The simplest solution for you would be for each of the child forms to
        implement a property which returned the dataset.

        Sijin Joseph





        Charles A. Lackman wrote:[color=blue]
        > Hello,
        >
        > Thank you for your help. I still have to problems. I will Domonstrate what
        > I am experiencing:
        >
        > (Main App.exe) ->instantiates as mdiChild->(Customer.Dl l)->sends populated
        > Dataset to - is also a mdiChild to Main App.exe->(Activity.Dl l)
        >
        > Information is also sent to (Contract.Dll) which is also a mdiChild of Main
        > App - from both Customer.Dll and Activity.Dll
        >
        > In the Main Application I was able to make a reference to all the forms (The
        > Dlls) and instantiate them and have them displayed as mdiChildren, which
        > works fine. I can send a dataset from the Main App to the Dlls without
        > problems. The real problem is sending the modified dataset back to the main
        > app when the form (Dll) has lost focus. Forms (Dlls) are not closed they
        > are simply hidden. As you can see, the problem is referecing the
        > Activity.Dll from both the Main App.exe and the Customer.Dll.
        >
        > The Articles you sent gave me some good ideas, but they are hard for me to
        > read because they are not in VB.NET. Sorry, anyway, when the Activity Form
        > looses focus, how do I make the form send a value to the Main App.
        >
        > In the Main App Load Event I :
        >
        > Activity.MdiPar ent = Me
        > Activity.Show()
        >
        > The code continues to run using show (cannot use showdialog with mdiParent),
        > so how would I send a value back to the Main App when the LostFocus event is
        > fired in the Activity Form?
        >
        > Could I implement an interface that handles the Activity LostFocus Event?
        > but if so, how would I determine when the event was fired from the Main App?
        >
        > Thank You,
        > Chuck
        >
        >
        > "Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
        > news:OfQ%23iaPh EHA.704@TK2MSFT NGP09.phx.gbl.. .
        >[color=green]
        >>Well basically what you are doing is creating a plugin architecture for
        >>your application. What you need to do in this case is to facilitate
        >>communicati on between the plugin forms using Interfaces. The interface
        >>will be common and you will be passing a reference to the interface
        >>between the forms rather than passing the actual form objects.
        >>
        >>check out these articles on CodeProject about Plugin architectures
        >>
        >>http://www.codeproject.com/csharp/C_...chitecture.asp
        >>http://www.codeproject.com/csharp/pluginmanager.asp
        >>http://www.codeproject.com/csharp/PluginsInCSharp.asp
        >>http://www.codeproject.com/dotnet/SM...dinArticle.asp
        >>
        >>Let me know if you need further help.
        >>
        >>Sijin Joseph
        >>http://www.indiangeek.net
        >>http://weblogs.asp.net/sjoseph
        >>
        >>
        >>
        >>Charles A. Lackman wrote:
        >>[color=darkred]
        >>>I am working on a application that has many custom made dlls. Actually,[/color][/color]
        >
        > for
        >[color=green][color=darkred]
        >>>this app each dll is a different form. I am able, with no problem to
        >>>reference and instantiate them to use their public properties and[/color][/color]
        >
        > methods
        >[color=green][color=darkred]
        >>>with no problem. But, if one dll is trying to access another dll's
        >>>properties (this does not work very good) the project tries to copy the[/color][/color]
        >
        > dll
        >[color=green][color=darkred]
        >>>to the directory which already contains the dll and the app will not
        >>>compile. I have tried different ways to work around this, ie.
        >>>
        >>>Create a Class that instantiates all the forms from the dlls and[/color][/color]
        >
        > reference
        >[color=green][color=darkred]
        >>>the Class from whatever needs them. I can reference them just fine but
        >>>cannot instantiate anything. Basically I am referencing a reference[/color][/color]
        >
        > from a
        >[color=green][color=darkred]
        >>>reference.
        >>>
        >>>Is there a way to Globally include all the dll's in the project using a
        >>>config file or something so that once the dll is referenced, it is
        >>>accessible by everything that is referenced from the Main App and[/color][/color]
        >
        > Eachother?
        >[color=green][color=darkred]
        >>>I don't believe this is very efficient and would greatly appreciate any
        >>>suggestion s, on better ways to accomplish this. The basic plan is to[/color][/color]
        >
        > have
        >[color=green][color=darkred]
        >>>all the forms independant of the Main App so that if a single form is
        >>>changed all that is needed is to updated is the corresponding dll.
        >>>
        >>>Thanks,
        >>>
        >>>Chuck
        >>>
        >>>
        >>>[/color][/color]
        >
        >
        >[/color]

        Comment

        • Charles A. Lackman

          #5
          Re: Multiple References and Object Instantiation??

          Hello Again,

          Yes, I have already done that, as stated in the post below. I am looking
          for a way to send data back to the main application when the LostFocus Event
          fires in the Child forms.

          Thanks,
          Chuck

          "Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
          news:OWv9M7dhEH A.140@TK2MSFTNG P12.phx.gbl...[color=blue]
          > The simplest solution for you would be for each of the child forms to
          > implement a property which returned the dataset.
          >
          > Sijin Joseph
          > http://www.indiangeek.net
          > http://weblogs.asp.net/sjoseph
          >
          >
          >
          > Charles A. Lackman wrote:[color=green]
          > > Hello,
          > >
          > > Thank you for your help. I still have to problems. I will Domonstrate[/color][/color]
          what[color=blue][color=green]
          > > I am experiencing:
          > >
          > > (Main App.exe) ->instantiates as mdiChild->(Customer.Dl l)->sends[/color][/color]
          populated[color=blue][color=green]
          > > Dataset to - is also a mdiChild to Main App.exe->(Activity.Dl l)
          > >
          > > Information is also sent to (Contract.Dll) which is also a mdiChild of[/color][/color]
          Main[color=blue][color=green]
          > > App - from both Customer.Dll and Activity.Dll
          > >
          > > In the Main Application I was able to make a reference to all the forms[/color][/color]
          (The[color=blue][color=green]
          > > Dlls) and instantiate them and have them displayed as mdiChildren, which
          > > works fine. I can send a dataset from the Main App to the Dlls without
          > > problems. The real problem is sending the modified dataset back to the[/color][/color]
          main[color=blue][color=green]
          > > app when the form (Dll) has lost focus. Forms (Dlls) are not closed[/color][/color]
          they[color=blue][color=green]
          > > are simply hidden. As you can see, the problem is referecing the
          > > Activity.Dll from both the Main App.exe and the Customer.Dll.
          > >
          > > The Articles you sent gave me some good ideas, but they are hard for me[/color][/color]
          to[color=blue][color=green]
          > > read because they are not in VB.NET. Sorry, anyway, when the Activity[/color][/color]
          Form[color=blue][color=green]
          > > looses focus, how do I make the form send a value to the Main App.
          > >
          > > In the Main App Load Event I :
          > >
          > > Activity.MdiPar ent = Me
          > > Activity.Show()
          > >
          > > The code continues to run using show (cannot use showdialog with[/color][/color]
          mdiParent),[color=blue][color=green]
          > > so how would I send a value back to the Main App when the LostFocus[/color][/color]
          event is[color=blue][color=green]
          > > fired in the Activity Form?
          > >
          > > Could I implement an interface that handles the Activity LostFocus[/color][/color]
          Event?[color=blue][color=green]
          > > but if so, how would I determine when the event was fired from the Main[/color][/color]
          App?[color=blue][color=green]
          > >
          > > Thank You,
          > > Chuck
          > >
          > >
          > > "Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
          > > news:OfQ%23iaPh EHA.704@TK2MSFT NGP09.phx.gbl.. .
          > >[color=darkred]
          > >>Well basically what you are doing is creating a plugin architecture for
          > >>your application. What you need to do in this case is to facilitate
          > >>communicati on between the plugin forms using Interfaces. The interface
          > >>will be common and you will be passing a reference to the interface
          > >>between the forms rather than passing the actual form objects.
          > >>
          > >>check out these articles on CodeProject about Plugin architectures
          > >>
          > >>http://www.codeproject.com/csharp/C_...chitecture.asp
          > >>http://www.codeproject.com/csharp/pluginmanager.asp
          > >>http://www.codeproject.com/csharp/PluginsInCSharp.asp
          > >>http://www.codeproject.com/dotnet/SM...dinArticle.asp
          > >>
          > >>Let me know if you need further help.
          > >>
          > >>Sijin Joseph
          > >>http://www.indiangeek.net
          > >>http://weblogs.asp.net/sjoseph
          > >>
          > >>
          > >>
          > >>Charles A. Lackman wrote:
          > >>
          > >>>I am working on a application that has many custom made dlls.[/color][/color][/color]
          Actually,[color=blue][color=green]
          > >
          > > for
          > >[color=darkred]
          > >>>this app each dll is a different form. I am able, with no problem to
          > >>>reference and instantiate them to use their public properties and[/color]
          > >
          > > methods
          > >[color=darkred]
          > >>>with no problem. But, if one dll is trying to access another dll's
          > >>>properties (this does not work very good) the project tries to copy the[/color]
          > >
          > > dll
          > >[color=darkred]
          > >>>to the directory which already contains the dll and the app will not
          > >>>compile. I have tried different ways to work around this, ie.
          > >>>
          > >>>Create a Class that instantiates all the forms from the dlls and[/color]
          > >
          > > reference
          > >[color=darkred]
          > >>>the Class from whatever needs them. I can reference them just fine but
          > >>>cannot instantiate anything. Basically I am referencing a reference[/color]
          > >
          > > from a
          > >[color=darkred]
          > >>>reference.
          > >>>
          > >>>Is there a way to Globally include all the dll's in the project using a
          > >>>config file or something so that once the dll is referenced, it is
          > >>>accessible by everything that is referenced from the Main App and[/color]
          > >
          > > Eachother?
          > >[color=darkred]
          > >>>I don't believe this is very efficient and would greatly appreciate any
          > >>>suggestion s, on better ways to accomplish this. The basic plan is to[/color]
          > >
          > > have
          > >[color=darkred]
          > >>>all the forms independant of the Main App so that if a single form is
          > >>>changed all that is needed is to updated is the corresponding dll.
          > >>>
          > >>>Thanks,
          > >>>
          > >>>Chuck
          > >>>
          > >>>
          > >>>[/color]
          > >
          > >
          > >[/color][/color]


          Comment

          • Sijin Joseph

            #6
            Re: Multiple References and Object Instantiation??

            Attach an event handler to the child form , Lost Focus event. In the
            event handler get the dataset using the property you have defined and
            pass it to the other child form.

            Sijin Joseph





            Charles A. Lackman wrote:[color=blue]
            > Hello Again,
            >
            > Yes, I have already done that, as stated in the post below. I am looking
            > for a way to send data back to the main application when the LostFocus Event
            > fires in the Child forms.
            >
            > Thanks,
            > Chuck
            >
            > "Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
            > news:OWv9M7dhEH A.140@TK2MSFTNG P12.phx.gbl...
            >[color=green]
            >>The simplest solution for you would be for each of the child forms to
            >>implement a property which returned the dataset.
            >>
            >>Sijin Joseph
            >>http://www.indiangeek.net
            >>http://weblogs.asp.net/sjoseph
            >>
            >>
            >>
            >>Charles A. Lackman wrote:
            >>[color=darkred]
            >>>Hello,
            >>>
            >>>Thank you for your help. I still have to problems. I will Domonstrate[/color][/color]
            >
            > what
            >[color=green][color=darkred]
            >>>I am experiencing:
            >>>
            >>>(Main App.exe) ->instantiates as mdiChild->(Customer.Dl l)->sends[/color][/color]
            >
            > populated
            >[color=green][color=darkred]
            >>>Dataset to - is also a mdiChild to Main App.exe->(Activity.Dl l)
            >>>
            >>>Informatio n is also sent to (Contract.Dll) which is also a mdiChild of[/color][/color]
            >
            > Main
            >[color=green][color=darkred]
            >>>App - from both Customer.Dll and Activity.Dll
            >>>
            >>>In the Main Application I was able to make a reference to all the forms[/color][/color]
            >
            > (The
            >[color=green][color=darkred]
            >>>Dlls) and instantiate them and have them displayed as mdiChildren, which
            >>>works fine. I can send a dataset from the Main App to the Dlls without
            >>>problems. The real problem is sending the modified dataset back to the[/color][/color]
            >
            > main
            >[color=green][color=darkred]
            >>>app when the form (Dll) has lost focus. Forms (Dlls) are not closed[/color][/color]
            >
            > they
            >[color=green][color=darkred]
            >>>are simply hidden. As you can see, the problem is referecing the
            >>>Activity.D ll from both the Main App.exe and the Customer.Dll.
            >>>
            >>>The Articles you sent gave me some good ideas, but they are hard for me[/color][/color]
            >
            > to
            >[color=green][color=darkred]
            >>>read because they are not in VB.NET. Sorry, anyway, when the Activity[/color][/color]
            >
            > Form
            >[color=green][color=darkred]
            >>>looses focus, how do I make the form send a value to the Main App.
            >>>
            >>>In the Main App Load Event I :
            >>>
            >>>Activity.Mdi Parent = Me
            >>>Activity.Sho w()
            >>>
            >>>The code continues to run using show (cannot use showdialog with[/color][/color]
            >
            > mdiParent),
            >[color=green][color=darkred]
            >>>so how would I send a value back to the Main App when the LostFocus[/color][/color]
            >
            > event is
            >[color=green][color=darkred]
            >>>fired in the Activity Form?
            >>>
            >>>Could I implement an interface that handles the Activity LostFocus[/color][/color]
            >
            > Event?
            >[color=green][color=darkred]
            >>>but if so, how would I determine when the event was fired from the Main[/color][/color]
            >
            > App?
            >[color=green][color=darkred]
            >>>Thank You,
            >>>Chuck
            >>>
            >>>
            >>>"Sijin Joseph" <sijinNOSPAMdot net@hotmail.com > wrote in message
            >>>news:OfQ%23i aPhEHA.704@TK2M SFTNGP09.phx.gb l...
            >>>
            >>>
            >>>>Well basically what you are doing is creating a plugin architecture for
            >>>>your application. What you need to do in this case is to facilitate
            >>>>communicati on between the plugin forms using Interfaces. The interface
            >>>>will be common and you will be passing a reference to the interface
            >>>>between the forms rather than passing the actual form objects.
            >>>>
            >>>>check out these articles on CodeProject about Plugin architectures
            >>>>
            >>>>http://www.codeproject.com/csharp/C_...chitecture.asp
            >>>>http://www.codeproject.com/csharp/pluginmanager.asp
            >>>>http://www.codeproject.com/csharp/PluginsInCSharp.asp
            >>>>http://www.codeproject.com/dotnet/SM...dinArticle.asp
            >>>>
            >>>>Let me know if you need further help.
            >>>>
            >>>>Sijin Joseph
            >>>>http://www.indiangeek.net
            >>>>http://weblogs.asp.net/sjoseph
            >>>>
            >>>>
            >>>>
            >>>>Charles A. Lackman wrote:
            >>>>
            >>>>
            >>>>>I am working on a application that has many custom made dlls.[/color][/color]
            >
            > Actually,
            >[color=green][color=darkred]
            >>>for
            >>>
            >>>
            >>>>>this app each dll is a different form. I am able, with no problem to
            >>>>>referenc e and instantiate them to use their public properties and
            >>>
            >>>methods
            >>>
            >>>
            >>>>>with no problem. But, if one dll is trying to access another dll's
            >>>>>properti es (this does not work very good) the project tries to copy the
            >>>
            >>>dll
            >>>
            >>>
            >>>>>to the directory which already contains the dll and the app will not
            >>>>>compile. I have tried different ways to work around this, ie.
            >>>>>
            >>>>>Create a Class that instantiates all the forms from the dlls and
            >>>
            >>>reference
            >>>
            >>>
            >>>>>the Class from whatever needs them. I can reference them just fine but
            >>>>>cannot instantiate anything. Basically I am referencing a reference
            >>>
            >>>from a
            >>>
            >>>
            >>>>>referenc e.
            >>>>>
            >>>>>Is there a way to Globally include all the dll's in the project using a
            >>>>>config file or something so that once the dll is referenced, it is
            >>>>>accessib le by everything that is referenced from the Main App and
            >>>
            >>>Eachother?
            >>>
            >>>
            >>>>>I don't believe this is very efficient and would greatly appreciate any
            >>>>>suggestion s, on better ways to accomplish this. The basic plan is to
            >>>
            >>>have
            >>>
            >>>
            >>>>>all the forms independant of the Main App so that if a single form is
            >>>>>changed all that is needed is to updated is the corresponding dll.
            >>>>>
            >>>>>Thanks,
            >>>>>
            >>>>>Chuck
            >>>>>
            >>>>>
            >>>>>
            >>>
            >>>
            >>>[/color][/color]
            >
            >[/color]

            Comment

            Working...