Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListView items

Status
Not open for further replies.

csharper77

Programmer
Jun 20, 2003
1
0
0
US
I have a listview with a few hundred rows, and each row contains four different values that are divided by columns (looks something like this):
FileName Artist SongName Path
row1 cool.mp3 me cool C:\cool.mp3
row2 notcool.mp3 Jimbo Not Cool C:\badsongs\notcool.mp3
....
etc.

i am trying to write a playlist out of these. How can i get the information from the path column and set it as a string, or maybe each row into an array?
thanks
 
I think this should work. As always, other suggestions are welcome as I'm not much of a programmer =). Replace the Array with whatever you want to contain the final list.

int numItems = this.listView1.Items.Count;
Array myArray = Array.CreateInstance( typeof(String), numItems);


for (int x = 0; x < numItems; x++)
{
myArray[x] = this.listView1.Items[x].SubItems[3].ToString();
}

You could also use foreach to iterate through all the ListViewItems. Not sure what would be the better approach, or indeed if it matters all that much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top