Solved

My own ActiveX DLL, huh ?!

Posted on 1998-08-05
5
219 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

10 Experts available now in Live!

Get 1:1 Help Now