Solved

My own ActiveX DLL, huh ?!

Posted on 1998-08-05
5
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

631 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