Why this way, while reading large CSV data output text box particularly slow Private Sub Command6_Click () Dim TextLine Dim TextString Dim SplitStr As the Variant Dim SplitStr2 As the Variant Dim As Long, I j As Long Dim s As String Dim m, n As Integer Dim (a) As String Open "DATAFILE. CSV" For Input As # 1 'Open the file, The Do While Not EOF (1) 'circular end of the file to, Line Input # 1, the TextLine 'read in a row and give it a variable,
If TextString="" Then TextString=TextLine The Else TextString=TextString & amp; ";" & TextLine End the If Loop Close # 1 'Close the file,
SplitStr=Split (TextString, ";" ) M=UBound (SplitStr) For I=0 To m SplitStr2=Split (SplitStr (I), ", ") N=UBound (SplitStr2) ReDim a (0 To m, 0 To n) For j=0 To n A (I, j)=SplitStr2 (j) Text1. Text=Text1. Text + a (I, j) & amp; " "Next j Text1. Text=Text1. Text & amp; VbCrLf Next I End Sub
CodePudding user response:
I already say with you,
With a variable to hold the first and the last one-time setup to text boxes, didn't you see?
CodePudding user response:
I already say with you,
With a variable to hold the first and the last one-time setup to text boxes, didn't you see? Oh, oh I see, Both dim STR dim I as long as the string, r both dim the data as string () as string, lines () as string open "XXX. CSV" for input as # 1 STR=input (lof (1), (1) the close # 1 lines=split (STR, VBCRLF) for I=lbound (lines) to ubound (lines) data=https://bbs.csdn.net/topics/split (lines (I), ", ") if I=lbound (lines), then r=data (0) & amp; "" & amp; Data (1) & amp; "" & amp; Data (3) & amp; "" & amp; Data (4) the else r=r & amp; VBCRLF & amp; Data (0) & amp; "" & amp; Data (1) & amp; "" & amp; Data (3) & amp; "" & amp; Data (4) end if next text1. Text=r
But always prompted to lower the standard, influential CSV data quantity is big??