Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:30:44+00:00 2026-06-13T07:30:44+00:00

What I want is for the app to read the first line from a

  • 0

What I want is for the app to read the first line from a text file and output it to the textReply textbox, then wait for X time before reading and outputting the next line.

Dim fileIn As New System.IO.StreamReader("C:\test.txt")
Dim strData As String = ""
While (Not (fileIn.EndOfStream))
    strData = fileIn.ReadLine()
    textReply.Text = textReply.Text & strData & vbCr
    System.Threading.Thread.Sleep(1000)
End While

As you can see I have tried sleeping the thread (not ideal as I want the app to stay responsive but thats another matter!) but every time it reads the whole file and dumps the lot into the textbox.

The reason is eventually it will be used for a serial connection to a device which needs time for the data transfer to the device and for the device to respond to each line sent.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:30:45+00:00Added an answer on June 13, 2026 at 7:30 am

    You can create a Queue of string add each line to the list as you are reading the file, then you can poll it with a timer and add them to your textbox one at a time.

    Public Class Form1
        Dim myQueue As Queue(Of String) = New Queue(Of String)
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            Dim fileIn As New System.IO.StreamReader("C:\test.txt")
            Timer1.Start()
            Dim strData As String = ""
            While (Not (fileIn.EndOfStream))
                strData = fileIn.ReadLine()
                myQueue.Enqueue(strData)
            End While
        End Sub
    
        Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
            If myQueue.Count > 0 Then
                textReply.Text += myQueue.Dequeue & vbCrLf
            End If
        End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read an .xml file from a web radio for my app.
I want to read .ppt files from the iPhone mail app. I have already
I want to deploy a applicacion in appharbor, in local my app read and
I want my app to stop playing video after specific time period (say 30
I want my app to catch downloads of a particular kind of file. Here's
I have the following code that read input from txt file as follow Paris,Juli,5,3,6
I want to create a file, save data and then append some information to
I am using Linkedin Api in my Iphone App.I want to read the Connection
this is my first app and i need to be using dates i want
I need to get 1 or more locations from a config file and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.