Home All Groups Group Topic Archive Search About

how to appened data into a arraylist?

Author
4 Aug 2006 3:30 PM
dotnetnoob
i got a program with a dropdown combobox that will go and grab data off of a
xml file that was selected from dropdown after the user chose a file then
click select button it add data into an arraylist, i want the user to be able
to appened more data if they select another file and so on.

how do i do it?

Author
4 Aug 2006 5:07 PM
Tom Shelton
dotnetnoob wrote:
> i got a program with a dropdown combobox that will go and grab data off of a
> xml file that was selected from dropdown after the user chose a file then
> click select button it add data into an arraylist, i want the user to be able
> to appened more data if they select another file and so on.
>
> how do i do it?

Dim myArrayList As New ArrayList
myArrayList.Add (WhateverDataObjectHere)
myArrayList.Add (AnotherDataObjectHere)
....

Call the arraylists add method.

--
Tom Shelton [MVP]
Author
4 Aug 2006 7:25 PM
dotnetnoob
Dim nlEqObjName As Xml.XmlNodeList =
doc.SelectNodes("/AutomationControl/EquipmentObjects/EquipmentObject/GeneralProperties/@ObjectName")
        Dim nEqObjName As Xml.XmlNode
        For Each nEqObjName In nlEqObjName
            arlsEqObjName.Add(nEqObjName.InnerText)
        Next
        Dim nlEqObjInstNum As Xml.XmlNodeList =
doc.SelectNodes("/AutomationControl/EquipmentObjects/EquipmentObject/GeneralProperties/@InstanceNumber")
        Dim nEqObjInstNum As Xml.XmlNode
        For Each nEqObjInstNum In nlEqObjInstNum
            arlsEqObjInstNum.Add(nEqObjInstNum.InnerText)
        Next

when the user click the select button again after chosing another xml file,
the pervious selected data from the pervious xml files are replace when
calling the above sub. how do i retain the pervious data and append the new
data.


Show quoteHide quote
"Tom Shelton" wrote:

>
> dotnetnoob wrote:
> > i got a program with a dropdown combobox that will go and grab data off of a
> > xml file that was selected from dropdown after the user chose a file then
> > click select button it add data into an arraylist, i want the user to be able
> > to appened more data if they select another file and so on.
> >
> > how do i do it?
>
> Dim myArrayList As New ArrayList
> myArrayList.Add (WhateverDataObjectHere)
> myArrayList.Add (AnotherDataObjectHere)
> ....
>
> Call the arraylists add method.
>
> --
> Tom Shelton [MVP]
>
>