Quantcast
Viewing all articles
Browse latest Browse all 15067

VS 2017 Load Multiline Text File Into DataGridView

if I have text to load into a datagridview control, how would I load something like this into it from a text file?

Entry1: Entry 1 Data
Entry2: Entry 2 Data
Entry3: Entry 3 Data
Entry4: Entry 4 Data
Entry5: Entry 5 Data
Entry6: Entry 6 Data
Entry7: Entry 7 Data
Entry8: Entry 8 Data
Entry9: Entry 10 Data
Entry10: Entry 11 Data
Entry11: Entry 12 Data
Entry12: Entry 13 Data
Entry13: Entry 14 Data
Entry14: Entry 15 Data

I only want to load the text after this :

so far I have this to open the file but not sure how to proceed after it

Code:

OpenFileDialog1.FileName = ""
        OpenFileDialog1.Title = "Open Text File"
        OpenFileDialog1.InitialDirectory = "c:\"
        OpenFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
        OpenFileDialog1.FilterIndex = 1
        OpenFileDialog1.RestoreDirectory = True

        If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then

        End If

I have 18 cells across in the datagridview and I need to load the specific text lines into specific data cells.

Viewing all articles
Browse latest Browse all 15067

Trending Articles



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