Click to See Complete Forum and Search --> : No out-of-process components?


DSJ
July 25th, 2002, 03:32 PM
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?

Cimperiali
July 26th, 2002, 07:14 AM
Shared components...
Do not know if this is the same, but have a look at keyword
"shared" in Msdn

DSJ
July 26th, 2002, 08:36 AM
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.)

DSJ
July 26th, 2002, 08:57 AM
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