Home > Software engineering >  [appeal] to read text files into Text1 how to display the progress bar
[appeal] to read text files into Text1 how to display the progress bar

Time:09-19

Read text files into Text1 how to display the progress bar

Below my a. og file will be read in Text1, only more than 40 KB read speed will slow, is there any way to speed up the reading speed, or join a progress bar,
Tell me read the schedule, thank you thank you very much,

 Dim InputData As String * 1 
The Open ". \ a. og "For Input As # 1
The Do While Not EOF (1)
InputData # (1, 1)=https://bbs.csdn.net/topics/Input
Text1. Text=Text1. Text + InputData
Loop
Close # 1

CodePudding user response:

Read to variables, and then assign a textbox

CodePudding user response:

reference 1st floor Runnerchin response:
read to variable, and assign a textbox

+ 1

Many people like to write code, like the original poster
That operation is really slow...
Should try to avoid repeating the operation objects (especially the "visual" object),

CodePudding user response:

I'm afraid there is no longer the slow way

CodePudding user response:

General text files are seconds reading, and makes little sense to progress, basically can not see, mainly is your code to read too low is too low, give you modify the following, window to add a Label1
 Dim InputData As String, FileNr As String, FileMz As String 
Dim FileCd As Long

FileMz="C: \ overlaystub log"
FileCd=FileLen (FileMz)

The Open FileMz For Input As # 1
The Do While Not EOF (1)
The Line Input # 1, InputData
FileNr=FileNr & amp; InputData & amp; VbCrLf
Label1. Caption=Len (FileNr)/FileCd * 100 & amp; "%", "
DoEvents
Loop
Close # 1

Text1. Text=FileNr

CodePudding user response:

The fundamental problem lies in a
Dim InputData As String * 1

Read-only string at a time, and wait for the next byte read disk had already turned in the past, so to be on a business trip to come over to read disk, you see, give you a 7200 RPM hard drive, you can only read one minute 7 k,

For the log files, generally used input line way

  • Related