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. Replace parts of an object in an ArrayList.But how ???

Replace parts of an object in an ArrayList.But how ???

Scheduled Pinned Locked Moved C#
databasehelpquestion
1 Posts 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    hi! I have a problem: here I read the data from the ArrayList into the ListView with a checkBox (displayCarListView.CheckBoxes = true; )public void ShowCar(ListView objectDisplayCarListView){ListView displayCarListView;displayCarListView = objectDisplayCarListView;foreach (Car car in carArrayList){MessageBox.Show(Convert.ToString(carArrayList.IndexOf(car)));int carIndex = carArrayList.IndexOf(car);ListViewItem newItem = newListViewItem(((Car)carArrayList[carIndex]).Manufacturer);newItem.SubItems.Add(((Car)carArrayList[carIndex]).Model );displayCarListView.Items.Add(newItem);}} now I would take this data that was checked in the ListView and put it in an other GUI with TextBoxes (it should the index of the car in the ArrayList must transfer also to the other GUI (but I don´t really know how! ;) )) I try it so: (but without the index....thats work 100% .... but I need the Index of the car...) public void ChangeCar(ListView objectDisplayCarListView){ListView displayCarListView;displayCarListView = objectDisplayCarListView;Car currentCar = new Car();if (displayCarListView.CheckedItems[0].Checked){ChangeCarNow currentChangeCarNow = new ChangeCarNow(this);currentChangeCarNow.manufactoreTextBox.Text =displayCarListView.CheckedItems[0].Text;currentChangeCarNow.modelTextBox.Text =displayCarListView.CheckedItems[0].SubItems[1].Text;//here the other GUI is show......with the datacurrentChangeCarNow.Show();}} in the GUI currentChangeCarNow(ChangeCarNow) it should be change the data of the car. the changes data of the car I must put back exactly in the same place where I take it out. that's why I need the index of the car have someone an idea how i can do this? big thx!! Pawel

    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