CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    No out-of-process components?

    I just installed .NET yesterday so haven't totally driven myself looney over this yet, but as far as I can tell it is no longer possible to create an out-of-process component so that two applications can share a single instance of anobject. Is this correct?

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    I have heard about...

    Shared components...
    Do not know if this is the same, but have a look at keyword
    "shared" in Msdn
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Yes, I saw the "shared" and thought that was the answer but still not working the way I'd like. I can get the Shared variable to work within a single application, but not between two or more. I'm working on something else right now, but will try to post a little code later. Basically what I need is for two applictions to have access to the same object. (The object is a connection to a database. Each connection cost a liscense, so all apps sharing one requires only on liscense... it works great with VB6. I have an ActiveX EXE which opens the connection and hands off a copy to any app that request it. So far in .NET each app is creating it's own instance of the "server" component, and thus opens a new connection.)

  4. #4
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    OK here's what I've got in a class library, what I need is for two apps to be able to change the value of teststring and the change be visible in the other application. If APP1 creates the object and changes the value to "New Value" and I create another object in APP1, then the value is "New Value" as expected, but if APP2 then creates the object the value is "Original".

    Public Class Class1
    Inherits System.ComponentModel.Component
    Shared TestString As String
    Shared Sub New()
    TestString = "Original"
    End Sub
    Public Property StringValue() As String
    Get
    StringValue = TestString
    End Get
    Set(ByVal Value As String)
    TestString = Value
    End Set
    End Property
    End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured