Hi

I have an interface that I have put in a separate dll.
I implement this interface in a user control ocx.

In my main program, i have the dll and ocx referenced,
and I load the user control depending on which form is showing.

I use this code to do it:

VB Code:
  1. Private Sub Form_Load()
  2.    Dim oCtl As Object
  3.    Dim ctlMain As FormControls.ctlBuy
  4.    Dim clsMain As FormClasses.clsForm
  5.  
  6.    Set oCtl = Controls.Add("FormControls.ctlBuy","ctlCur")
  7.    Set ctlMain = oCtl
  8.    ' I set the control's properties and show it here...
  9.    Set clsMain = ctlMain
  10. End Sub

This works fine until the statement 'Set clsMain = ctlMain'.
This gives a type mismatch error.

The dll is compiled with binary compability, and was compiled
before I started making my user control. I have checked that
it is the same dll that is referenced both from the main app and
from the ocx project.

What am I doing wrong here?