Solved

My own ActiveX DLL, huh ?!

Posted on 1998-08-05
5
222 Views
Last Modified: 2010-05-03
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
Comment
Question by:michelv
5 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1467885
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
 
LVL 2

Expert Comment

by:Jagar
ID: 1467886
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
 
LVL 4

Expert Comment

by:tomook
ID: 1467887
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
 
LVL 1

Expert Comment

by:cd74013
ID: 1467888
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
 
LVL 1

Accepted Solution

by:
BlackAndWhite earned 200 total points
ID: 1467889
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now