how to appened data into a arraylist?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dotnetnoob

    #1

    how to appened data into a arraylist?

    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?
  • Tom Shelton

    #2
    Re: how to appened data into a arraylist?


    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 (WhateverDataOb jectHere)
    myArrayList.Add (AnotherDataObj ectHere)
    ....

    Call the arraylists add method.

    --
    Tom Shelton [MVP]

    Comment

    • dotnetnoob

      #3
      Re: how to appened data into a arraylist?

      Dim nlEqObjName As Xml.XmlNodeList =
      doc.SelectNodes ("/AutomationContr ol/EquipmentObject s/EquipmentObject/GeneralProperti es/@ObjectName")
      Dim nEqObjName As Xml.XmlNode
      For Each nEqObjName In nlEqObjName
      arlsEqObjName.A dd(nEqObjName.I nnerText)
      Next
      Dim nlEqObjInstNum As Xml.XmlNodeList =
      doc.SelectNodes ("/AutomationContr ol/EquipmentObject s/EquipmentObject/GeneralProperti es/@InstanceNumber ")
      Dim nEqObjInstNum As Xml.XmlNode
      For Each nEqObjInstNum In nlEqObjInstNum
      arlsEqObjInstNu m.Add(nEqObjIns tNum.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.


      "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 (WhateverDataOb jectHere)
      myArrayList.Add (AnotherDataObj ectHere)
      ....
      >
      Call the arraylists add method.
      >
      --
      Tom Shelton [MVP]
      >
      >

      Comment

      Working...