|
-
Feb 11th, 2016, 11:45 AM
#1
Thread Starter
Member
partial .txt file to datagridview using vb.net
i have a user interface form that let's you upload a text file to a datagridview as follows
Sub Datagrid()
Dim sw = System.Diagnostics.Stopwatch.StartNew()
Using stream As System.IO.FileStream = System.IO.File.OpenRead(TextBox1.Text)
Using reader AsNew System.IO.StreamReader(stream)
Dim line AsString= reader.ReadLine()
While(line IsNot Nothing)
Dim columns = line.Split(";")
line = reader.ReadLine()
Dim index =Me.DataGridView1.Rows.Add()
Me.DataGridView1.Rows(index).SetValues(columns)
EndWhile
End Using
End Using
sw.Stop()
EndSub
Well, now my problem is that i don't want to put the full txt file in that datagridview, just from line N. Is it possible to do that? Like creating a querytabel and selecting a fixed value?
p.e., in line 5 there's always the text "Values:" . Can i select all the lines after that to put in the datagridview?
i googled everywhere but found nothing. and there's no "sample" code to give me a start .
thank you all !
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|