Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

[RESOLVED] Load ListView w/o .Add. Can you help?

$
0
0
I open and save the ListView like so:

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.

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:
Code:

Set itmx = lv.listitems.Add(,,"") OR Set itmx = lv.listitems.Add
itmx.Subitems(1) = str1 ... etc.

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.
Attached Images
 

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>