More then one line of text
i have a text file with disc name and what is on the disc, but sometimes there is five or six items on a disc and some time there will be only one.
i.e.
Disc 1,Game 1,Game 2,Game 3
Disc 2,Game 4,Game 5
Disc 3,Game 6,Game 7,Game 8,Game 9,Game 10,Game 11
on so on...
i have load the text in and printed it out to a listbox, but it just prints all the contents, here is the code
Code:
Private Sub Form_Load()
Dim DiscName As String
Dim ContentsofDisc As String
Dim num As Integer
Open "I:\VB6\Disc1.txt" For Input As #1
Input #1, DiscName, ContentofDisc
List1.AddItem DiscName
Close #1
End Sub
I want the disc list of the text file in the listbox and the game list to be printed on another part of the form.
Can anybody help me with this please
Re: More then one line of text
Quote:
Originally Posted by Champions_2002
i have a text file with disc name and what is on the disc, but sometimes there is five or six items on a disc and some time there will be only one.
i.e.
Disc 1,Game 1,Game 2,Game 3
Disc 2,Game 4,Game 5
Disc 3,Game 6,Game 7,Game 8,Game 9,Game 10,Game 11
on so on...
i have load the text in and printed it out to a listbox, but it just prints all the contents, here is the code
Code:
Private Sub Form_Load()
Dim DiscName As String
Dim ContentsofDisc As String
Dim num As Integer
Open "I:\VB6\Disc1.txt" For Input As #1
Input #1, DiscName, ContentofDisc
List1.AddItem DiscName
Close #1
End Sub
I want the disc list of the text file in the listbox and the game list to be printed on another part of the form.
Can anybody help me with this please
Why dont you use IF.
If ucase$(left$(a$,4)) = "DISC" then list1.additem
else: text1.text = a$
or something simmilar
Re: More then one line of text
Quote:
Originally Posted by Dungeon Keeper
Why dont you use IF. If ucase$(left$(a$,4)) = "DISC" then list1.additem
there are over 2000 disc, so doing that way will take an age.
Re: More then one line of text
try like
vb Code:
Open "I:\VB6\Disc1.txt" For Input As #1
inputarr = split(input(lof(1), #1), vbnewline)
Close #1
for i = 0 to ubound(inputarr)
linearr= split(inputarr(i), ",", 2)
list1.additem linearr(0)
text1 = text1 & vbnewline & linearr(1) ' do something with rest of list
next