• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

My own ActiveX DLL, huh ?!

Okay,

Hi, I wrote a Hierarchical tree Class that consists of:

HTree  -  Main Class
HNodes -  Nodes Collection
HNode  -  The Node

This Class works exactly like the TreeView1 control, except it has no visual interface, it's just the datastructure.

The Class works fine when I add the .cls files directly in the Project. But I want to make an ActiveX DLL of this class. The Class Compiles, I make a new Project, add a reference to the newly created ActiveX DLL and load the exact same code I used to test the class before it was compiled. Now comes the problem:

Run-time error 450
Wrong number of arguments or invalid property assignment

The creation of the object doesn't generate this error, it happens here:

Private Sub Form_Load()

    Dim nde     As HNode
    Dim Network As New HTree
   
    Set Network.Nodes.TreeView = TreeView1
   
    Set nde = Network.Nodes.Add(Key:="Root", Text:="Root")

>> At this line !!!    
    Set nde = Network.Nodes.Add("1st level Child 1", nde.Index, ndeChild, "1st level Child 1")
   
    Set nde = Network.Nodes.Add("2nd level Child 2", nde.Index, ndeChild, "2nd level Child 2")
   
    Set nde = Network.Nodes.Add("2nd level Child 1", nde.Index, ndePrevious, "2nd level Child 1")
   
    Set nde = Network.Nodes.Add("3rd level Child 3", nde.Index, ndeChild, "3rd level Child 3")
   
    Set nde = Network.Nodes.Add("3rd level Child 2", nde.Index, ndePrevious, "3rd level Child 2")
   
    Network.Nodes.Add "4rd level Child 3", nde.Index, ndeChild, "4rd level Child 3"
       
    Set nde = Network.Nodes.Add("3rd level Child 1", nde.Index, ndePrevious, "3rd level Child 1")
   
    Set nde = Network.Nodes.Add("4rd level Child 1", nde.Index, ndeChild, "4rd level Child 1")
   
    Set nde = Network.Nodes.Add("4rd level Child 2", nde.Index, ndeNext, "4rd level Child 2")
   
    Set nde = Network.Nodes.Add("5th level Child 1", nde.Index, ndeChild, "5th level Child 1")
   
    Set nde = Network.Nodes.Add("Root 2", 1, ndeNext, "Root 2")


Huh ?

It works with this project:

Form1.frm
HTree.cls
HNodes.cls
HNode.cls

But doesn't work with this

Form1.frm  (which is the same as the above form1.frm
with Ref. to DLL


Someone ?
Please !
0
michelv
Asked:
michelv
1 Solution
 
anthonycCommented:
send the source (zipped) to aecornetto@sai2000.com and I'll take a look.  If you can't, show me what the function headers of your functions  are
0
 
JagarCommented:
Try putting two project together one with the class files and the other with the test EXE (note do not put them into the same project, but rather into seperate project in the same group.)  Then try running the code and see what happens.
0
 
tomookCommented:
If you send a copy of your test project and activeX DLL project to tom@ndimensional.com, I will also take a look at it. (zipped please)
0
 
cd74013Commented:
Make sure that you have not referenced a copy of the .dll file in the VB references section as that will take preference over any included project in a project group.  Seems odd but the references does take precedence for class modules over other project classes in the project group.
0
 
BlackAndWhiteCommented:
The Add method of the Nodes collection class of yours seems to support only two arguments as said in

Set nde = Network.Nodes.Add(Key:="Root", Text:="Root")

but later you use the same 'Add' method with 4 arguments as in the line with the error.

    Set nde = Network.Nodes.Add("1st level Child 1", nde.Index, ndeChild, "1st level Child 1").

     If my guess is right your Add method has only two arguments. Right?! How can you pass 4?!!!

     I guess that is your problem from what I can infer based on the error message.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now