Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15006

DataGridView and file txt

$
0
0
Hey,

I would need help to use a SteamReader in order to read a file text and display some lines in a DataGridView.

This file text looks like this

Name:  Capture5.jpg
Views: 63
Size:  21.7 KB

Columns of the DataGridView will be "nb / length / mass[g.mol] / Chain / Details"

I'm reading the file line by line and trying to catch just those lines

Name:  Capture6.PNG
Views: 58
Size:  5.9 KB

Here is the code that i'm trying to do, I don't really know if using a StreamReader with a loop until the end of file is a good idea, and I'm not able to get only lines that I need.
I will join the file text if someone can give me help.

Code:

Do Until reader.EndOfStream
            '  getLines = reader.ReadLine()
            If reader.ReadLine.Contains("Code") And reader.EndOfStream = False Then
                reader.ReadLine()
                reader.ReadLine()
                test = reader.ReadLine.Substring(1, 11)
            Else
                ' reader.ReadLine()

            End If
    dt_sum_protamex.Rows.Add(test)
        Loop

Thank you.

test.txt
Attached Images
  
Attached Files

Viewing all articles
Browse latest Browse all 15006

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>