VB問題 - PCZONE 討論區

返回   PCZONE 討論區 > ▲ -- 電 腦 軟 體 討 論 區 > -- 其 他 軟 體 討 論 版


PCZONE 討論區



通知

-- 其 他 軟 體 討 論 版 包括磁碟或檔案管理工具、掃毒軟體、解壓縮軟體、遠端遙控軟體、備份軟體、傳真軟體、手寫或語音等各種軟體使用經驗討論

會員
VB問題
有一個txt檔內容如虛線內:
------------------------
1 -1 1
2.12345
------------------------
程式碼大約是這樣:
Option Explicit
Dim fs As New FileSystemObject
Dim f As TextStream
Dim draw As Boolean
Dim counter As Integer
Set f = fs.OpenTextFile("agree.txt")
If f.AtEndOfStream = False Then counter = f.ReadAll
counter = counter + 1
f.Close
Text2.Text = Format(counter, "00")
Set f = fs.CreateTextFile("agree.txt")
f.Write Text2.Text
f.Close
-------------------------------------------------------
我要如何寫才能使
txt檔案讀出時只讀第二行2.12345

回覆
圈外人

在 If 那一行之前加個 f.SkipLine 試試?
語法:
Set f = fs.OpenTextFile("c:\agree.txt")
f.SkipLine
If f.AtEndOfStream = False Then counter = f.ReadAll
回覆
會員

引用:
最初由 jute 發表
在 If 那一行之前加個 f.SkipLine 試試?
語法:
Set f = fs.OpenTextFile("c:\agree.txt")
f.SkipLine
If f.AtEndOfStream = False Then counter = f.ReadAll
謝謝你,可以了

回覆







 XML   RSS 2.0   RSS 
本站使用 vBulletin 合法版權程式
站務信箱 : [email protected]

本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。