Hi All,

I have a text document that am pulling infomation out of.
i only want to collect the information after the = sysmbol which is on each line.

here is the code so far

Dim FileName As String = "C:\test.txt"
        Dim TextFromTheFile As String ' Whole text
        Dim Lines() As String ' File splitted to lines
        Dim LineSeparator() As String = {Environment.NewLine} ' Line separator 'character'
        ' Use My namespace
        If My.Computer.FileSystem.FileExists(FileName) Then
            ' Read the file   
            TextFromTheFile = My.Computer.FileSystem.ReadAllText(FileName)
            ' Get lines. I used StringSplitOptions that removes empty lines  
            Lines = TextFromTheFile.Split(LineSeparator, System.StringSplitOptions.RemoveEmptyEntries)
            ' Now you have Lines() array ready  


            Me.TextBox1.Text = Lines(0)
            'TextBox2.Text = Lines(1)
            ' and so on...
        Else
            ' The file not found error  
            MessageBox.Show("File Does Not Exist", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If

lines(0) now contains server=localhost
i only want to show localhost
lines(1) contacts database=maintsystem and i only want to collect maintsystem

is this even possible?

Maybe on line 12 of your example you can add:

Dim Parts() As String = Lines(0).Split("="c)

then show the Parts(1)
or change the line 14 to

Me.TextBox1.Text=Lines(0).SubString(Lines(0).IndexOf("="c) + 1)

The first solution can fail if no '=' sign exists.
The second solution will show all the line content is no '=' sign exists.

Hope this helps

thanks for your help this was great.

have a good new year.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.