Thanks to jm who helped me the resizing array but for some reason I cannot get all the data listed in a listbox.
Now resolved~! feel so silly![]()
I have a data file "Phonelist" with 3 lists to which can utilised as the actual directories after user selects (& if not exist needs to be created). My problem is that the For Loop only lists the last item (of 3) in the listbox!!!![]()
BTW you will see that I have been playing around trying to get it to work!
VB Code:
Sub DisplayDir(ByVal fn As String, ByVal path As String) Dim sr As StreamReader Dim sw As StreamWriter Dim temp() As String Dim prompt, read As String Dim counter, i, j As Integer fn = "PHONELISTS.TXT" 'File with phone directories sr = File.OpenText(f & fn) counter = 0 'Counts number of directories listed Do While (sr.Peek <> -1) counter += 1 sr.ReadLine() Loop ReDim temp(counter) sr.Close() 'i = counter 'Reads file in temp array sr = File.OpenText(f & fn) :wave: Do While (sr.Peek <> -1) '[B]I forgot to do a for/next loop[/B] temp(counter) = sr.ReadLine Loop 'ReDim temp(i) sr.Close() [B] For j = 1 To counter :confused: lstOutput.Items.Add(temp(counter)) Next[/B] End Sub




Reply With Quote