Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Constructors in VB classes

Posted on 2002-07-03
1
Medium Priority
?
196 Views
Last Modified: 2010-05-02
I'm writing a VB class wrapping an XML document.  I would like to be able to create the class from a node in the constructor as follows:

    Dim node As IXMLDomNode
    Set node = GetNodeFromSomeWhere

    Dim myClass As New clsFoo(node)

Is this valid vb syntax, or do I have to do 2 phase construction as follows:

    Dim node As IXMLDomNode
    Set node = GetNodeFromSomeWhere

    Dim myClass As New clsFoo
    myClass.SetNode node
0
Comment
Question by:derekl
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 300 total points
ID: 7127575
>>Dim myClass As New clsFoo(node)

This syntax is available in VB.Net (and C#).
For VB6, you have to do in 2 phases...

CHeers

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Suggested Courses

971 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