Right I'm trying to read the lines of a text file in VB in a combo box, this is the code I am using. The problem is that it reads the file as an entire line and therefore displays it as one long string
I want the lines set out as they are written to the file:Code:Imports System.IO Public Class Form6 Private Sub SearchBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchBtn.Click Dim Members As String = "C:\Users\ADAM\Documents\Visual Studio 2008\Projects\Members.txt" Dim TextLine As String If System.IO.File.Exists(Members) = True Then Dim objReader As New System.IO.StreamReader(Members) Do While objReader.Peek() <> -1 TextLine = TextLine & objReader.ReadLine() & vbNewLine Loop IDFilter.Text = TextLine Else MsgBox("File Does Not Exist") End If End Sub End Class
094,Frickerman,21 Nicols Road,London,CT9 3RD,12/12/2011,07 March 2012,Gold
095,Opper,1 Beyom Place,Glasgow,CT9 1RP,13/01/1994,13 March 2012,Gold
Instead I get:
094,Frickerman,21 Nicols Road,London,CT9 3RD,12/12/2011,07 March 2012,Gold095,Opper,1 Beyom Place,Glasgow,CT9 1RP,13/01/1994,13 March 2012,Gold


Reply With Quote
