Click here to Skip to main content
15,922,007 members
Home / Discussions / C#
   

C#

 
GeneralRe: Control Problem Pin
BLaZiNiX22-Apr-02 11:24
BLaZiNiX22-Apr-02 11:24 
GeneralRe: Control Problem Pin
James T. Johnson23-Apr-02 4:09
James T. Johnson23-Apr-02 4:09 
GeneralRe: Control Problem Pin
BLaZiNiX23-Apr-02 11:04
BLaZiNiX23-Apr-02 11:04 
GeneralText Width Pin
Andrew Peace21-Apr-02 14:18
Andrew Peace21-Apr-02 14:18 
GeneralRe: Text Width Pin
James T. Johnson21-Apr-02 14:23
James T. Johnson21-Apr-02 14:23 
GeneralRe: Text Width Pin
Andrew Peace21-Apr-02 14:46
Andrew Peace21-Apr-02 14:46 
GeneralHey james it didn't work Pin
21-Apr-02 14:02
suss21-Apr-02 14:02 
GeneralRe: Hey james it didn't work Pin
James T. Johnson21-Apr-02 14:11
James T. Johnson21-Apr-02 14:11 
Sorry, confused ListBox and ListView :-P

I think the current technique is to derive a class from ListViewItem and use that, so...

public class ProcessListViewItem : ListViewItem
{
  public readonly Process Process;
  public ProcessListViewItem(Process p) : this(p.ProcessName)
  {
    Process = p;
  }
}
Now the Add method will work when you pass in an instance of this new list view item

Process [] Processes = Process.GetProcesses();
 
foreach( Process p in Processes )
{
  myListView.Items.Add( new ProcessListViewItem(p) );
}
Then when you want to get the underlying process object you just cast the ListViewItem returned from the Items collection back to the ProcessListViewItem and access the Process property.

HTH,

James

Simplicity Rules!
GeneralRe: Hey james it didn't work Pin
Neil Van Note21-Apr-02 15:23
Neil Van Note21-Apr-02 15:23 
GeneralRe: Hey james it didn't work Pin
James T. Johnson21-Apr-02 19:07
James T. Johnson21-Apr-02 19:07 
GeneralRe: Hey james it didn't work Pin
Neil Van Note21-Apr-02 19:12
Neil Van Note21-Apr-02 19:12 
GeneralRe: Hey james it didn't work Pin
James T. Johnson22-Apr-02 21:43
James T. Johnson22-Apr-02 21:43 
GeneralRe: Hey james it didn't work Pin
Neil Van Note23-Apr-02 2:33
Neil Van Note23-Apr-02 2:33 
GeneralRe: Hey james it didn't work Pin
James T. Johnson23-Apr-02 2:38
James T. Johnson23-Apr-02 2:38 
GeneralRe: Hey james it didn't work Pin
Neil Van Note23-Apr-02 3:06
Neil Van Note23-Apr-02 3:06 
Generallist view items Pin
shadowman21-Apr-02 13:25
shadowman21-Apr-02 13:25 
GeneralRe: list view items Pin
James T. Johnson21-Apr-02 13:46
James T. Johnson21-Apr-02 13:46 
GeneralKeyPress Pin
Mazdak21-Apr-02 7:43
Mazdak21-Apr-02 7:43 
GeneralRe: KeyPress Pin
ez221-Apr-02 7:53
ez221-Apr-02 7:53 
GeneralRe: KeyPress Pin
Mazdak21-Apr-02 7:57
Mazdak21-Apr-02 7:57 
GeneralRe: KeyPress Pin
Mazdak21-Apr-02 8:19
Mazdak21-Apr-02 8:19 
GeneralRe: KeyPress Pin
ez221-Apr-02 8:48
ez221-Apr-02 8:48 
GeneralRe: KeyPress Pin
Rüpel21-Apr-02 20:24
Rüpel21-Apr-02 20:24 
GeneralConnection StringII Pin
Mazdak21-Apr-02 7:38
Mazdak21-Apr-02 7:38 
GeneralRe: Connection StringII Pin
Neil Van Note21-Apr-02 16:08
Neil Van Note21-Apr-02 16:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.