Read File again

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

Hello World,

I have a Winform that reads records from a CSV file. It displays the record
(if <field> = TextBox1.Text) and fills the other textboxes and lables
with the info. So far so good. But when I give another request then nothing
happens because the program has reached the End of the CSV file.
Is there a way to restart the program without exiting and run again? A sort
of refresh? Or a way to let it read the file again..?

Here's the loop:

Do While Not objparser.EndOfData
Dim strvelden() As String = objparser.ReadFields

If conf = strvelden(5) Or conf = strvelden(1) Then

lblLogical.Text = strvelden(1)
txtSnr.Text = strvelden(5)
txtOwner.Text = strvelden(3)
txtOS.Text = strvelden(6)
txtSoort.Text = strvelden(0)
txtType.Text = strvelden(4)
txtScan.Text = strvelden(7)
txtLogonuser.Text = strvelden(8)

End If
Loop


Ray
 
Ray,

Don't use a Do While loop. You are looping through all the rows of data in
the file and what ends up in the textboxes is data from the last row.

Kerry Moorman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top