✔ 最佳答案
You can use .NET Framework's System.IO.File class or System.IO.StreamReader class to read a text file.
I show you an example on File class
Imports System
Imports System.IO
Imports System.Text
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Open and read the content of a file
Dim data As String = File.ReadAllText("c:\temp\name.txt")
Dim s() As String = {vbLf} ' this is the line feed character
' put the file content in an array separated by line feed
Dim result() As String = data.Split(s, StringSplitOptions.RemoveEmptyEntries)
' find out how many elements in the array
Dim i As Integer = result.Length
MessageBox.Show(i.ToString())
End Sub
End Class
2010-03-22 02:38:10 補充:
Look at this link for an example on using StreamReader class
http://tw.knowledge.yahoo.com/question/question?qid=1510031703520