-
Apr 10th, 2012, 04:50 AM
#1
Thread Starter
New Member
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.
-
Apr 10th, 2012, 06:20 AM
#2
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
)
-
Apr 10th, 2012, 06:05 PM
#3
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|