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. list view items

list view items

Scheduled Pinned Locked Moved C#
tutorial
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
    shadowman
    wrote on last edited by
    #1

    Hello..i used a listview to view the current processes in my Computer..but when i tryed to make any operations on these processes i couldn't ..i donnno how to convert the list items into objects of other class to perform these operations (im my case the System.diagnostics.process class) here's my code : private void Form1_Load(object sender, System.EventArgs e) { Process[]MyProcArray=Process.GetProcesses (); foreach (Process MyProc in MyProcArray) {this.ProcessesList .Items .Add (MyProc.ProcessName ); } :confused:

    J 1 Reply Last reply
    0
    • S shadowman

      Hello..i used a listview to view the current processes in my Computer..but when i tryed to make any operations on these processes i couldn't ..i donnno how to convert the list items into objects of other class to perform these operations (im my case the System.diagnostics.process class) here's my code : private void Form1_Load(object sender, System.EventArgs e) { Process[]MyProcArray=Process.GetProcesses (); foreach (Process MyProc in MyProcArray) {this.ProcessesList .Items .Add (MyProc.ProcessName ); } :confused:

      J Offline
      J Offline
      James T Johnson
      wrote on last edited by
      #2

      The problem you are seeing is because you are only adding the string which represents the process name to the list view, instead you need to add the Process object itself.

      private void Form1_Load(object sender, System.EventArgs e)
      {
      Process[] MyProcArray = Process.GetProcesses();

      foreach (Process MyProc in MyProcArray)
      {
      ProcessesList.Items.Add(MyProc);
      }
      }

      HTH, James Simplicity Rules!

      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