1 Replies - 819 Views - Last Post: 22 July 2013 - 12:42 PM Rate Topic: -----

#1 sasch2486  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-July 13

inserting a double-array in an object-array

Posted 22 July 2013 - 08:44 AM

Public Function xXML(Filepath As String) As Object()




	Set objParser = CreateObject("Microsoft.XMLDOM")
	Set OCC = "OMICRON CONTROL Center"

	Dim xDoc As MSXML2.DOMDocument
	Dim NodeList As IXMLDOMNodeList
	Dim Node As MSXML2.IXMLDOMElement

	Dim ObjTempArray(40) As Object


	Set xDoc = New MSXML2.DOMDocument


	'Prooves whether the document is a valid XML document.
	xDoc.validateOnParse = True

	'DTD = Document Type Definition


	If xDoc.load(Filepath) = False Then
		MsgBox ("Unable to load File.",vbExclamation,OCC)
	Else
		MsgBox(Filepath+" succesfully loaded!",vbInformation,OCC)
		StartAutomation = MsgBox ("Start Test-Automation?",vbOKCancel,OCC)

		If StartAutomation = vbCancel Then
			MsgBox("Test-Automation canceled.",vbInformation,OCC)

		Else
			'Reading the *.cid file
			MsgBox("Automation Start!",vbInformation,OCC)

		'	Set NodeList = xDoc.documentElement.selectNodes("//catalog/book/author")
			Set NodeList = xDoc.documentElement.selectNodes("//SCL/IED/AccessPoint/Server/LDevice/LN")



			For Each Node In NodeList


				NodeType = Node.getAttribute("lnClass")


				If NodeType = "PTOC" Then

					'Name of array is PTOC

					Dim PTOC(2) As Double

					PTOC(0) = 1
					PTOC(1) = 1
					PTOC(2) = 1


					ObjTempArray(0) = PTOC()


					MsgBox("Yes")

				End If

			Next

			xXML = ObjTempArray


			x = NodeList.length
			MsgBox(x)



		End If
	End If



End Function


Hi Everyone,

Hi Everyone,

i got an error when trying to set the first element of the objtemparray( ObjTempArray(0) = PTOC)
The Error is: Object var is 'Nothing'

I m trying for an hour now and cant guess of my mistake, if anyone can tell me where my mistake is i would be very thankful. :-)


best regards

Sascha

Is This A Good Question/Topic? 0
  • +

Replies To: inserting a double-array in an object-array

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,793
  • Joined: 26-March 09

Re: inserting a double-array in an object-array

Posted 22 July 2013 - 12:42 PM

Not exactly sure what this function does or why you've declared it as an object type array.

If you want to store another array, if you declare it as variant type, then that should work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1