Placement of data in ListView (urgent)

kobezt08

Member
Joined
Dec 30, 2004
Messages
6
Programming Experience
Beginner
open.ShowDialog()
Dim myObjectsFromFile As New CPersonalList
myObjectsFromFile.LoadPersonalObjects(open.FileName)
Dim i As Integer
For i = 0 To myObjectsFromFile.GetObjectCount - 1
lvwObjects.Items.Add(myObjectsFromFile.getObject(i + 1).First)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Second)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Horoscope)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Fourth)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Fifth)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Sixth)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Seventh)
lvwObjects.Items(i).SubItems.Add(myObjectsFromFile.getObject(i + 1).Eighth)
Next


Data form text file: 000189,380661,SUPERSTAR VIRGO,410081,0813,2.200,5.76,12.67

I have the above code which sucessfully place data extracted from a Coma delimited text file in Column 1-8 of a ListView which have 12 ColumnHeader.

Problem:
How can i specify the data to be display in specific column?

E.g. Puting myObjectsFromFile.getObject(i + 1).Second in the 12th column instead of the 2nd, the myObjectsFromFile.getObject(i + 1).Third in the 9th column instead of 3rd .etc

Note: Juz a sample break down of what i need to do as my actuall requirement is slightly mroe complex
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
You can set the text value of the specific index value of the subItem:
VB.NET:
lvwObjects.Items(i).SubItems(11).Text = myObjectsFromFile.getObject(i + 1).Second
But, you have to have added the subItem to the Item's ListViewSubItem collection first.
You could add another loop within your loop, adding 12 subItems with an empty string value. Then set their text value as shown above.
 
Top Bottom