Group:  Microsoft Access ยป microsoft.public.access.activexcontrol
Thread: Call DotNet Application From Access - Cannot Release Dotnet Application

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Call DotNet Application From Access - Cannot Release Dotnet Application
"Derek Hart" <derekmhart[ at ]yahoo.com> 01.12.2005 18:31:27
Help!



I cannot get my DotNet application to shut down as an automation server from
Access.



I have the following simple code in Access that I am using to call a VB.NET
application:



Dim w As Object
Set w = CreateObject("MyProgram.MyProgramClass")
w.MyProgramDoSomething
Set w = Nothing



I have tried many things in DotNet. The final lines of the application are
the following:



System.GC.Collect()

System.GC.WaitForPendingFinalizers()



When I run the above code in Access to call the program, it runs it, which
opens up a DotNet WindowsForm, and then I shut down the WindowsForm, and
when I run the Access code again, it runs the DotNet app again, but the
DotNet app was never fully released. For example, Datasets that were filled
with data get added to, and the data is doubled! Task manager does not show
that the program is running, but Access still holds a connection. By the
way, if I exit Access and open it up again and run the above code, it works
fine. How do I properly exit the DotNet app?



Thank You,

Derek Hart


Re: Call DotNet Application From Access - Cannot Release Dotnet Application
"TC" <aatcbbtccctc[ at ]yahoo.com> 02.12.2005 08:29:00
[Quoted Text]
>From my viewpoint as an Access VBA guy, that should work fine. (But I
don't know anything about .NET.)

How about this as a long shot. Access itself has a property,
UserControl, of the Application object. If you automate Access, and
make the automated instance visible, then set UserControl=true, that
instance will not go away when you set the object variable to nothing.
So maybe, .NET (or its forms) has a similar property, which is
automagically set True when the instance becomes visible? If so, maybe
you could set that property back False before you drop the object
reference.

As I say, this is nothing more than a stab in the dark.

(Snipped microsoft.public.access.modulescoding, cos google groups would
not post there.)

HTH,
TC

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net