日期:2012-11-05  浏览次数:20402 次

开始时引用
Imports System.IO

按钮的Click事件
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'打开目标文件(文件流)
Dim myFs As New FileStream(Application.StartupPath & "\a.txt", FileMode.Open, FileAccess.Read)
'读文件
Dim r As New StreamReader(myFs)
Dim i As Integer
Dim myLine, tempStr As String
'创建数组,接收文件数据
Dim myLineStr(), a(100), b(100) As String
Dim c(100) As Integer
i = 0
myLine = r.ReadLine
Do While Not (myLine Is Nothing)
myLineStr = myLine.Split(",")
a(i) = myLineStr(0)
b(i) = myLineStr(1)
c(i) = myLineStr(2)
i += 1
Loop
End Sub