D
Dave F.
Hi
I got a problem using multiple listboxes.
I have 3 of them: Listbox 1-3
If I click another option in 1 it reloads 2 with new info.
The same if I click in box 2 with box 3.
The marked line >>>>> doesn't set Listbox2.value to anything, just "". There
is a value in YY(0).nodeName
I'm confused as to why: The same line in UserForm_Initialize works fine.
Any ideas where I'm going wrong?
Thanks
David F.
Option Explicit
Dim MsDom As DOMDocument
Sub UserForm_Initialize()
Dim XX As IXMLDOMNodeList
Dim Itm As IXMLDOMNode
Set MsDom = CreateObject("MSXML.DOMDocument")
MsDom.Load ("c:\dwgs\fx2005\fxlayersXML.xml")
MsDom.async = False
Set XX = MsDom.selectNodes("/layers/*") ' all of selected layers
With ListBox1
For Each Itm In XX
.AddItem Itm.nodeName ' puts each of the layer names into the
lisbox
Next
End With
ListBox1.Value = XX(0).nodeName ' goes to LB2 change
End Sub
Sub ListBox1_Change() ' 1
Dim ChldNode As IXMLDOMNodeList
Dim Itm As IXMLDOMNode
Dim YY As IXMLDOMNodeList
Set YY = MsDom.selectNodes("/layers/" & ListBox1.Value & "/*")
With ListBox2
.Clear ' removes items from listbox2
For Each Itm In YY
.AddItem Itm.nodeName
Next
End With
Debug.Print YY(0).nodeNameset - why?
End Sub
Sub ListBox2_Change() ' 2
Dim Itm As IXMLDOMNode
Dim ZZ As IXMLDOMNodeList
Debug.Print "/layers/" & ListBox1.Value & "/" & ListBox2.Value & "/x "
Set ZZ = MsDom.selectNodes("/layers/" & ListBox1.Value & "/" &
ListBox2.Value & "/x")
With ListBox3
.Clear ' removes items from listbox3
For Each Itm In ZZ
.AddItem Itm.Text ' puts each of the serials sizes into the
lisbox
Next
End With
End Sub ' listbox2 change
Sub CboCancel_Click()
Me.Hide
End Sub
I got a problem using multiple listboxes.
I have 3 of them: Listbox 1-3
If I click another option in 1 it reloads 2 with new info.
The same if I click in box 2 with box 3.
The marked line >>>>> doesn't set Listbox2.value to anything, just "". There
is a value in YY(0).nodeName
I'm confused as to why: The same line in UserForm_Initialize works fine.
Any ideas where I'm going wrong?
Thanks
David F.
Option Explicit
Dim MsDom As DOMDocument
Sub UserForm_Initialize()
Dim XX As IXMLDOMNodeList
Dim Itm As IXMLDOMNode
Set MsDom = CreateObject("MSXML.DOMDocument")
MsDom.Load ("c:\dwgs\fx2005\fxlayersXML.xml")
MsDom.async = False
Set XX = MsDom.selectNodes("/layers/*") ' all of selected layers
With ListBox1
For Each Itm In XX
.AddItem Itm.nodeName ' puts each of the layer names into the
lisbox
Next
End With
ListBox1.Value = XX(0).nodeName ' goes to LB2 change
End Sub
Sub ListBox1_Change() ' 1
Dim ChldNode As IXMLDOMNodeList
Dim Itm As IXMLDOMNode
Dim YY As IXMLDOMNodeList
Set YY = MsDom.selectNodes("/layers/" & ListBox1.Value & "/*")
With ListBox2
.Clear ' removes items from listbox2
For Each Itm In YY
.AddItem Itm.nodeName
Next
End With
Debug.Print YY(0).nodeNameset - why?
End Sub
Sub ListBox2_Change() ' 2
Dim Itm As IXMLDOMNode
Dim ZZ As IXMLDOMNodeList
Debug.Print "/layers/" & ListBox1.Value & "/" & ListBox2.Value & "/x "
Set ZZ = MsDom.selectNodes("/layers/" & ListBox1.Value & "/" &
ListBox2.Value & "/x")
With ListBox3
.Clear ' removes items from listbox3
For Each Itm In ZZ
.AddItem Itm.Text ' puts each of the serials sizes into the
lisbox
Next
End With
End Sub ' listbox2 change
Sub CboCancel_Click()
Me.Hide
End Sub