Dim iLine() As String open "文件路径" for input as #1 iLine = Split(#1, Chr(13)) For i = 0 To UBound(iLine) .... Next
Dim iLine() As String open "文件路径" for input as #1 iLine = Split(#1, Chr(13)) For i = 0 To UBound(iLine) .... Next
你可以把它导入到SQL,ACCESS等数据库里,那就是关系二维数据库啦!
open "文件路径" for input as #1'以INPUT方式打开文件,文件号为1 do until lof(1)循环直至读完为止 text1.seltext=lineinput 1'单行输入 loop close 1
可以用fso(文件系统对象)编写
Dim iLine() As String open "文件路径" for input as #1 iLine = Split(#1, Chr(13)) For i = 0 To UBound(iLine) .... Next 和 FileSystemObject 要用的话。有区别码 FileSystemObject 是window 98自带的马?
Dim iLine() As String open "文件路径" for input as #1 iLine = Split(#1, Chr(13)) For i = 0 To UBound(iLine) .... Next 是VB中比郊老的一种文件读写方法,而FileSystemObject 是VB6的新特性,很好用的,它不是WINDOW 98自带的,是VB自带的。
Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim s(20) As String Open "C:\aa.txt" For Output As #1 For i = 0 To 10 Print #1, Str(i); "er048-,sjfogj-e0ub [cmj[df" Next i Close #1 Open "C:\aa.txt" For Input As #1 i = 0 Do Until EOF(1) Line Input #1, s(i) '一行一行的读 'Print s(i) i = i + 1 Loop Close #1 Print i For j = 0 To i - 1 Print s(j) Next j End SubPrivate Sub Command2_Click() Dim i As Integer Dim j As Integer Dim s(100) As String Open "C:\aa.txt" For Input As #1 i = 0 Do Until EOF(1) Input #1, s(i) Print s(i) i = i + 1 Loop Close #1 End SubPrivate Sub Command3_Click() Dim s As String CommonDialog1.ShowOpen If CommonDialog1.filename <> "" Then Open CommonDialog1.filename For Input As #1 Do Until EOF(1) Input #1, s Print s Loop Close #1 End If End Sub
open "文件路径" for input as #1
iLine = Split(#1, Chr(13))
For i = 0 To UBound(iLine)
.... Next
open "文件路径" for input as #1
iLine = Split(#1, Chr(13))
For i = 0 To UBound(iLine)
.... Next
do until lof(1)循环直至读完为止
text1.seltext=lineinput 1'单行输入
loop
close 1
open "文件路径" for input as #1
iLine = Split(#1, Chr(13))
For i = 0 To UBound(iLine)
.... Next
和 FileSystemObject 要用的话。有区别码
FileSystemObject 是window 98自带的马?
open "文件路径" for input as #1
iLine = Split(#1, Chr(13))
For i = 0 To UBound(iLine)
.... Next
是VB中比郊老的一种文件读写方法,而FileSystemObject 是VB6的新特性,很好用的,它不是WINDOW 98自带的,是VB自带的。
Dim i As Integer
Dim j As Integer
Dim s(20) As String
Open "C:\aa.txt" For Output As #1
For i = 0 To 10
Print #1, Str(i); "er048-,sjfogj-e0ub [cmj[df"
Next i
Close #1
Open "C:\aa.txt" For Input As #1
i = 0
Do Until EOF(1)
Line Input #1, s(i) '一行一行的读
'Print s(i)
i = i + 1
Loop
Close #1
Print i
For j = 0 To i - 1
Print s(j)
Next j
End SubPrivate Sub Command2_Click()
Dim i As Integer
Dim j As Integer
Dim s(100) As String
Open "C:\aa.txt" For Input As #1
i = 0
Do Until EOF(1)
Input #1, s(i)
Print s(i)
i = i + 1
Loop
Close #1
End SubPrivate Sub Command3_Click()
Dim s As String
CommonDialog1.ShowOpen
If CommonDialog1.filename <> "" Then
Open CommonDialog1.filename For Input As #1
Do Until EOF(1)
Input #1, s
Print s
Loop
Close #1
End If
End Sub
CommonDialog1
CommonDialog1