VB /VB.net 點可以控制佢讀TXT 某一行?

2007-06-25 11:05 am
例如:我想讀a.txt 的18 行入變數txtdata
要點做?

回答 (1)

2007-06-25 6:13 pm
✔ 最佳答案
參考以下範例,
Dim oFile as System.IO.File
Dim oRead as System.IO.StreamReader
dim intLine as integer
oRead = oFile.OpenText(“C:\sample.txt”)
intLine = 0
While oRead.Peek <> -1
LineIn = oRead.ReadLine()
if intLine=17 then
txtdata.text = linein
end if
End While

oRead.Close()


收錄日期: 2021-04-27 14:58:12
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070625000051KK00495

檢視 Wayback Machine 備份