txtContent.Text = "" '清除內容
Open sFile$ For Input As #1 '開啟文字檔
txtContent.Text = StrConv(InputB(LOF(F), #1), vbUnicode) '一次讀入整個檔案
Close #1 '關閉檔案
出自:
http://yes.nctu.edu.tw/VB/A1_Tips/Fi...tBox/Index.htm
=========================
其實捨去 Unicode 轉換很簡單可知原理
就是
Input(number, [#]filenumber)
Input 函數的語法具有以下幾個單元:
單元 說明
number 必要的引數。任何正確的數值運算式,用來指出欲傳回的字元個數。
filenumber 必要的引數。任何正確的檔案代碼。
配合用 LOF 來得到檔案的長度
附註: InputB 函數是用來讀取文字檔中的位元組資料。不過在 InputB 函數中的引數 number 不是用來指出欲傳回的字元個數,而是用來指出欲傳回的位元組個數。