how to show a lots of data though MSFlexGrid [*resolved]
I need to read a text file and output the data
I tried the code below
but because the data is so many that it takes much time to run
how to faster it?
please help me, thanks very much
'=======================================
TotalNum = 0 'the total row of the file, about 7050
'first loop to get the row of the file
Open App.Path & "\1.dat" For Input As #1
Do While Not EOF(1)
Line Input #1, MyData1
TotalNum = TotalNum + 1
Loop
Close #1
MSFlexGrid1.Rows = TotalNum + 1
'the second loop to send data to MSFlexGrid1
i = 0
Open App.Path & "\1.dat" For Input As #1
Do While Not EOF(1)
Line Input #1, MyData1
i = i + 1
TempString = MyData1
MyData1 = Split(TempString, ",")
With MSFlexGrid1
.Row = i
.Col = 0
.Text = MyData1(0)
.Col = 1
.Text = MyData1(1)
.Col = 2
.Text = MyData1(2)
.Col = 3
.Text = MyData1(3)
.Col = 4
.Text = MyData1(4)
End With
Loop
'========================================
a part of the text file
2.,217.6604,199.8500,199.8500,200.4962
4.,227.5204,199.8500,199.8500,201.0546
6.,234.5468,199.8501,199.8500,201.5784
8.,240.2048,199.8503,199.8500,202.0836
10.,245.0417,199.8509,199.8500,202.5763
12.,249.3170,199.8520,199.8500,203.0596
14.,253.1766,199.8542,199.8500,203.5354
16.,256.7126,199.8580,199.8500,204.0048
18.,259.9873,199.8641,199.8500,204.4688
20.,263.0456,199.8732,199.8500,204.9279
22.,265.9207,199.8861,199.8500,205.3826
24.,268.6383,199.9038,199.8500,205.8334
26.,271.2185,199.9271,199.8500,206.2806
28.,273.6777,199.9569,199.8500,206.7244
30.,276.0292,199.9939,199.8500,207.1650
32.,278.2840,200.0390,199.8500,207.6028
34.,280.4515,200.0927,199.8500,208.0378
36.,282.5396,200.1556,199.8500,208.4702
38.,284.5551,200.2283,199.8500,208.9001
40.,286.5039,200.3111,199.8500,209.3276
42.,288.3912,200.4043,199.8500,209.7530
44.,290.2215,200.5082,199.8500,210.1761
46.,291.9988,200.6230,199.8500,210.5972
48.,293.7268,200.7487,199.8500,211.0163
50.,295.4086,200.8853,199.8500,211.4335
52.,297.0470,201.0329,199.8500,211.8489
54.,298.6447,201.1914,199.8500,212.2624
56.,300.2041,201.3606,199.8501,212.6743
58.,301.7272,201.5403,199.8501,213.0844
60.,303.2160,201.7306,199.8501,213.4930
Re: how to show a lots of data though MSFlexGrid [*resolved]
thanks for your suggestion
and I will correct my habits
:p :p :p :p :p