Why does this sound oh, so familiar. Okay, if it works the first time but
not the second, it would appear that the first creation of the object
creates a the object under a specific user account.
When you add an additional reference to that object -- you have not set obj
references to nothing in VB6 world-- because the object is already up and
running either the permissions of the running object is locking you out or
the object can only be created once.
That's why, when you restart your machine, the object goes out of scope and
you can create it once again. It is also why, when you dropped the new
keyword and used createobject it worked.
Drop the typelib reference to these objects in your VB6 project and just use
createobject and see if that helps. Plus setting the objects to nothing will
help as well.
[quoted text, click to view] "Ton" <Ton@discussions.microsoft.com> wrote in message
news:C0EF2BF0-FAE8-4A71-8129-1EDDB15A117E@microsoft.com...
> Hi,
> I've developed several Webuser controls. One of the controls is using a
> VB6
> based activeX component. The code looks like:
>
> Dim dbF As Object ''dbRecordFrm.dbRecordForm
> If ses Is Nothing Then
> ses = CreateObject("dbOLEserver.Session")
> End If
> dbF = CreateObject("dbRecordFrm.dbRecordForm")
> On the last line I receive an error:
> Server Error in '/WebApplication1' Application.
> --------------------------------------------------------------------------------
> Cannot create ActiveX component.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about
> the error and where it originated in the code.
> Exception Details: System.Exception: Cannot create ActiveX component.
>
> If I restart my development PC It works fine for the fisttime. But a
> second
> time fails. I've given the ASPNET- user administrator rights!
> On all forms ASPCOM=True
>
> Other COM objects don't have these problems, allthough I had the same
> problems on other pc's, but these problems disapeared when I changed the
> creation of the object from the NEW keyword to CREATEOBJECT.
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.573;
> ASP.NET
> Version:1.1.4322.573
>
> Thank you
>
>
>