I have a Sheridan (now Infragistics) Treeview control on a VB 6 form. I try to pass the treeview control object to a dll that also has a treeview control on its form. Sometimes the dll recognizes the passed object as a treeview control and sometimes it does not. I have added the DLL to my VB 6 program's references. It always works when the calling VB 6 program and the DLL are part of the same project, but sometimes when the VB 6 code (or compiled VB 6 program) run, this part of the DLL displays the error message that indicates that the SSTree object is not an ssactivetreeview control. I put the "If typeof.." statement in because when the code does not function it does not raise an error message, it just does nothing. The message "Error in DMDialog/SearchFolders - bad TypeOf SSTree " is what displays when it does not work, which indicates the treeview object is not passing correctly.

I am also enclosing the VB 6 code that calls the DLL. Can anyone tell me what iswrong with this? Thanks!

DLL code (Called code)

Public Function SearchFolders(SSTree As Object, sCabinetType As String, sFolder As String)
On Error GoTo SF_Err
Dim sLine As String
sLine = " 1"
If TypeOf SSTree Is ssactivetreeview.SSTree Then
sLine = " 2"
Call LoadTree(SSTree, sCabinetType, sFolder)
MsgBox (" Error in DMDialog/SearchFolders - bad TypeOf SSTree ")
End If
Exit Function
MsgBox ("Err in DMDialog/SearchFolders " & sLine)

End Function

VB 6 executable (.EXE) code that calls the DLL above:

Set moDialog = New DMDialog.DialogClass

With moDialog
.Cabinet = gsCabinetType
Set .Connection = Dmdb
Set .SamConnection = Anidb
Set .ParisConnection = ParisPdb
Set .ProspectConnection = Prospdb
sLastErr = .LastErr.Num
slastErrorDesc = .LastErr.Msg
sLastErrorLocation = .LastErr.Proc
Call .SearchFolders(SSTree1, .Cabinet, txtName)
End With