I open and save the ListView like so:
The first column, itmx.Text, won't change and it comes from a different file because I couldn't figure out how to load the subItems without throwing things off. For example, when I omit the counter, and use .Add:
All the subItems went on rows below the last item in column 1 because the first column isn't empty. It returns something like this where "B" is sub1 and should be next to Mary:
![Name: errepy.jpg
Views: 40
Size: 14.4 KB]()
Anyway, my open and save statements work, and puts everything in order but I have a long list of subs; lots of I&O's. Is there another way to load and save the ListView, and use one file for a text column (1) that won't change, and subs that will change? I'm using VB5.
Code:
Open App.Path & \"text.txt" for Input as #FF
While Not EOF(FF)
Line Input #FF, strTxt
lv.listitems.Add ,, strTxt
Wend
Close #FF
Open App.Path & \"lv.txt" for Input as #FF
While Not EOF(FF)
lgnItem = lngItem + 1
Line Input #FF, str1
Set itmx = lv.listitems(lngItem)
itmx.Subitems(1) = str1
lng2Item = lng2Item + 1
Line Input #FF, str2
Set itmx = lv.ListItems(lng2Item)
itmx.SubItems(2) = str2 ... etc.
Wend
Close #FF
Open App.Path & \"lv.txt" for Output as #FF
For i = 1 to frmMain.lv.listitems.Count
Print #FF, lv.listitems(i).Subitems(1) ... etc.
Code:
Set itmx = lv.listitems.Add(,,"") OR Set itmx = lv.listitems.Add
itmx.Subitems(1) = str1 ... etc.
Anyway, my open and save statements work, and puts everything in order but I have a long list of subs; lots of I&O's. Is there another way to load and save the ListView, and use one file for a text column (1) that won't change, and subs that will change? I'm using VB5.