Windows Form ListView problem 
Author Message
 Windows Form ListView problem

I'm a little stumped by the doco not matchine the code..

I would like to be able to add a value for the columns in an item Something

Listview1.Item[0].subitem(0,"column 1 text");
Listview1.Item[1].subitem(1,"column 2 text");

I would appreciate being told how this should be put in

Beta 2

I still cannot do it all in one line of code either:

I'm trying to add items to a listview

I would like to know how to add ListViewItems like this
ListViewItem.ListViewItem(string[] items);

I have the following code to put in an item with two columns

Value, attribute.Name + ": " + attribute.InnerText + "\r\n")); And I'm
obviously not putting the strings into an appropriate array. Thx Mark

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://www.*-*-*.com/ .

Tue, 06 Apr 2004 00:14:49 GMT  
 Windows Form ListView problem

I think I can answer the first part of your question. I had a little
difficulty myself getting the correct syntax for adding items to a
listview. This brief example (in C#) uses the process class to get all of
the instances of a running application, and then adds the MainWindowTitle
and the Process ID to a listview.

To add items to a list view, you add the first item in a row using Items.
Add. You then add subsequent items to that row using SubItems.Add.  In this
example, you end up with the Window Title in the first column and the
Process Id in the second column. Something like:

   ListViewItem itemAdd ;
   processes = Process.GetProcessesByName(procName);
   foreach (Process proc in processes)
           itemAdd = ListView1.Items.Add(proc.MainWindowTitle);

Hope this helps,


Arial;}{\f1\froman\fcharset0 Times New Roman;}}
{\colortbl ;\red0\green0\blue128;}
\viewkind4\uc1\pard\sb100\sa100\cf1\f0\fs20 This posting is provided
\ldblquote AS IS\rdblquote  with no warranties, and confers no rights. You
assume all risk for your use. \'a9 2001 Microsoft Corporation. All rights


Sun, 18 Apr 2004 23:09:48 GMT  
 [ 2 post ] 

 Relevant Pages 

1. System.Windows.Forms.ListView

2. Windows Forms treeview/listview

3. classes that inherit from Windows.Forms.Form - problem with View Designer

4. Make Windows Form Application with VC++.NET 2002 using a visual form

5. System.Windows.Forms.Form

6. Extending System.Windows.Forms.Form?

7. Windows Forms to Web Forms


9. Displaying XML in a System.Windows.Forms.Form control

10. Web form textbox Vs Windows form textbox.....

11. Need to keep a windows form as the topmost form

12. System.Windows.Forms & Inheritance problem


Powered by phpBB® Forum Software