ListView Problems 
Author Message
 ListView Problems

Hi,

I've got some problems with the ListView control.
I'd like to get some information from a selected ListViewItem, but I'm stuck
with the following error:
Cannot convert type 'System.Windows.Forms.ListViewItem' to 'string[]'

The following code kind og shows my problem:

string[] info = {"Some info", "Some other info"};
ListViewItem LVI = new ListViewItem(info);
string[] info2 = (string[])LVI;

I know that I can't just convert LVI to string[], but how do I get the
content of LVI to a string-array?

Sincerely,
Kenneth



Sun, 29 Feb 2004 22:22:26 GMT  
 ListView Problems
The way I have done it is to grab the "Text" property of the item,
then go through the sub-items, and get their "Text" property.  I don't
know of a way to simply get a string array, but you could write a
function that takes a ListViewItem and will return a string[] (based
off of the item and all sub-items)

Jason



Quote:
>Hi,

>I've got some problems with the ListView control.
>I'd like to get some information from a selected ListViewItem, but I'm stuck
>with the following error:
>Cannot convert type 'System.Windows.Forms.ListViewItem' to 'string[]'

>The following code kind og shows my problem:

>string[] info = {"Some info", "Some other info"};
>ListViewItem LVI = new ListViewItem(info);
>string[] info2 = (string[])LVI;

>I know that I can't just convert LVI to string[], but how do I get the
>content of LVI to a string-array?

>Sincerely,
>Kenneth



Fri, 05 Mar 2004 10:06:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Windows Form ListView problem

2. Listview problems

3. ListView-Problem in conjunction with COM

4. REALLY annoying listview problem

5. REALLY annoying listview problem

6. Listview problem

7. ListView Problem!!(Right button popup menu)

8. ListView Problem.

9. ListView problems: Displaying a button in a column

10. Listview problems : Handling LVN_ITEMCHANGING

11. Listview problems:how do i display a button on the listcontrol

12. CustomDraw in ListView problem

 

 
Powered by phpBB® Forum Software