dim FileSystemObject,TextStream as Object
dim aryfile() as string
dim strtemp as string
dim intCount as integer
dim datal() as integer
dim data2() as string
set FileSystemObject = createObject("Scripting.FileSystemObject")
set TextStream = fileSystemobject.openTextFile("C:\a.txt")
do while not textstream.AtEndOfStream<> true
strTemp = TextStream.ReadLine
intCount = intCount + 1
ReDim Preserve aryFile(0 To intCount - 1)
aryFile(intCount - 1) = Trim(strTemp)
Loop
TextStream.Close
for i = 0 to intCount -1 step 2
....
next i
for i = 1 to intCount step 2
....
next i
Private Sub Form_Load()
Dim strTmp As String, strArray() As String, F(10) As Integer, C(10) As String
Dim i As Integer
Open "C:\aa.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, strTmp
strArray() = Split(strTmp, " ")
F(i) = strArray(0)
C(i) = strArray(1)
这样做吧:
dim FileSystemObject,TextStream as Object
dim aryfile() as string
dim strtemp as string
dim intCount as integer
dim datal() as integer
dim data2() as string
set FileSystemObject = createObject("Scripting.FileSystemObject")
set TextStream = fileSystemobject.openTextFile("C:\a.txt")
do while not textstream.AtEndOfStream<> true
strTemp = TextStream.ReadLine
intCount = intCount + 1
ReDim Preserve aryFile(0 To intCount - 1)
aryFile(intCount - 1) = Trim(strTemp)
Loop
TextStream.Close
for i = 0 to intCount -1 step 2
....
next i
for i = 1 to intCount step 2
....
next i