Solved

Constructors in VB classes

Posted on 2002-07-03
1
181 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 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

706 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

20 Experts available now in Live!

Get 1:1 Help Now