Results 1 to 3 of 3

Thread: vb6 - User-defined type not defined

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    9

    vb6 - User-defined type not defined

    HI,

    I am trying to modify a pre-written program by others. I copy the original form frmMain to frmMain2.

    But when I compile this code for frmMain2 that I copied, I got error message user-defined type undefined. the code is as follow:

    //form
    Private Sub Form_Load()
    ....

    LoadAlarms mAlarmCollection
    .....
    End Sub


    //XMLStorage Module
    Public Sub LoadAlarms(ByRef AlarmCol As Collection)
    Dim xmlDoc As DOMDocument <---the error here
    Dim i As Long
    Dim nodeAlarms As IXMLDOMElement
    Dim nodeAlarm As IXMLDOMElement
    Dim oAlarm As clsAlarmSetting

    Set AlarmCol = New Collection

    ......
    End Sub


    It works fine with original frmMain, but does not work with frmMain2.

    When I debug, frmMain does not go to DIm xmlDoc, but go stratight to SetAlarm = New Collection.

    But when i debuf frmMain2, it goes to Dim xmldoc and error occurs.

    Is there anything that i missed out? how do i define DOMDocument?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: vb6 - User-defined type not defined

    Go back to the first project.

    Click on Project/References.

    You will see things in there that are checked that you don't have checked in the second project.

    DOMDocument is not a built in data type. It requires an external reference to be added to the project.

    The first project has that reference, the second project doesn't.

    (
    Without that reference, you would get the same error on:
    Dim nodeAlarms As IXMLDOMElement
    Dim nodeAlarm As IXMLDOMElement
    )

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    9

    Re: vb6 - User-defined type not defined

    Thanks hack! it works!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width