ukjock Posted December 14, 2003 Posted December 14, 2003 I am able to write to a text file no problem. it store's it in the manner that i require: 14/12/2003 | 16:12 | HEARTS VERSUS HIBS 14/12/2003 | 16:12 | LAVINE SHOULD BE FORCED TO RESIGN 14/12/2003 | 16:12 | LAVINE SHOULD QUIT When i open the text file to be read in a listbox they appear like so: 14/12/2003 | 16:12 | HEARTS VERSUS HIBS14/12/2003 | 16:12 | LAVINE SHOULD BE FORCED TO RESIGN 14/12/2003 | 16:12 | LAVINE SHOULD QUIT it actually goes out of the listbox and I can only read a small amount instead of multiple lines. my code is : Dim H As New History Dim a As AddCaller Dim sr As New IO.StreamReader(New IO.FileStream(Application.StartupPath & "\Logs\Caller_history\" & TextBox4.Text & ".txt", IO.FileMode.OpenOrCreate)) Dim textfromfile As String = sr.ReadToEnd() H.ListBox1.Items.Add(textfromfile) sr.Close() H.Visible = True is this becuase i am only adding the text file as 1 item and not multiple? If so how do i go around doing multi line adding from a textbox? is it fairly straight forward. Thanks Chris Quote ----------------- It�s always funny until someone gets hurt� Then it become hilarious!
*Experts* mutant Posted December 14, 2003 *Experts* Posted December 14, 2003 You can do it like this: 'read as long as there is anything to read from the file Do While reader.Read() 'use the read line method to read a line from the file ListBox1.Items.Add(reader.ReadLine()) Loop Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.