Home > Software engineering >  Vb to read TXT documents to the textbox
Vb to read TXT documents to the textbox

Time:11-30

TXT documents have many rows, need VB in sequence from the first line of every five seconds to read a row, each row have eight fields, such as: 1,2,3,4,5,6,7,8, in each of the eight fields respectively read into eight textbox, until the end of the reading,

CodePudding user response:

It isn't difficult at all,

"Every 5 seconds to read 1 row", it is ok to use the Timer control,
Specific to read the file, there are many kinds of schemes to implement,

Your "eight fields in a row," that you have to clear the data format!
If not, who knows what kind of, you need to do to "is divided into eight!"

To put the data into a TextBox, use the control array and can be done For loop;
Even the independent control, control pattern, but also 8, hard to write article 8 assignment statements directly also just as well...

CodePudding user response:

Have not learned VB mainly, but the graduation design to use, eight all strings

CodePudding user response:

Why every 5 seconds as opposed to every 0.05 seconds

CodePudding user response:

 Option Explicit 
Dim flag As Boolean

Private Sub Command1_Click ()
Dim strLine As String, strCol () As String
Dim As Long, I n the As Long

Timer1. Interval=5000
Timer1. Enabled=True

Label1="Reading... "

Open "c: \ test \ test1. TXT" For Input As # 1
Do Until EOF (1)
The Line Input # 1, strLine
StrCol=Split (strLine, ", ")

N=UBound (strCol)

For I=0 To 7
If I & lt;=n Then
Text1 (I)=strCol (I)
The Else
Text1 (I)=""
End the If
Text1 (I). Refresh
Next I

Do Until flag
DoEvents
Loop

Flag=False
Loop
Close # 1

Timer1. Enabled=False

Label1="Finished"

End Sub

Private Sub Timer1_Timer ()
Flag=True
End Sub

CodePudding user response:

reference ayalicer reply: 3/f
why every 5 seconds as opposed to every 0.05 seconds
so fast, don't let apple rain batter to death?

CodePudding user response:

refer to the second floor qq_42230566 response:
mainly have not learned VB, but should use graduation design, 8 are all string

Did you say this is not to say...

CodePudding user response:

Institute of technology of profession of VB6 visual programming (wuxi) http://download.csdn.net/detail/zhao4zhong1/6824713

CodePudding user response:


Note: to join the time control

CodePudding user response:

The upstairs, you tried your code?

CodePudding user response:

I'm afraid you even "time control" (" the Timer control "!) What the "operation mode" (I mean in the "application"),
Haven't understand...
  • Related