Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How t store the values in arraylist in c#

How t store the values in arraylist in c#

Scheduled Pinned Locked Moved C#
helpcsharpdata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sdev85
    wrote on last edited by
    #1

    I am trying to store the values of 5 textbxes of a form fr each user into an arrayList and then iterate through the list fr the details of each usern using a foreach statement. I have a problem in writing the code that implements it. ex: UserId, Fname, Lname, addr, city, state -> save these values into an array list and iterate thrugh the list front and back. _-- Please help me out:confused:

    Shashank

    I 1 Reply Last reply
    0
    • S sdev85

      I am trying to store the values of 5 textbxes of a form fr each user into an arrayList and then iterate through the list fr the details of each usern using a foreach statement. I have a problem in writing the code that implements it. ex: UserId, Fname, Lname, addr, city, state -> save these values into an array list and iterate thrugh the list front and back. _-- Please help me out:confused:

      Shashank

      I Offline
      I Offline
      InOut NET
      wrote on last edited by
      #2

      Theres alot of way doing this. Least of code way would be: ArrayList lst = new ArrayList(); Foreach( TextBox txt in Form.Controls) { lst.Add(txt.Text); } //now your Arraylist contains all the data in textboxes on the form. Hope it helps you. PS:My C# syntax needs some dusting-off, so the code above may not compile as is - but .NET concept works.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups