執行程式後,會自動讀取某個純文字檔案(.TXT)內容
並"一個一個"字顯示在 Label 或 TextBox內
直到內容顯示完畢為止... ^^"
2006-09-20 14:44:30 · 2 個解答 · 發問者 ¦Ü¨} ª 5 in 電腦與網際網路 ➔ 程式設計
'表單置1個CommandButton,1個Label或TextBox,若是用TextBox請把MultiLine=True,ScrollBars=3,先以Label來做.Private Sub Command1_Click() Dim I&, S$ Label1.AutoSize = True Label1.WordWrap = True Label1 = "" Open "C:\Test.txt" For Input As #1 '假設檔案是"C:\Test.txt" I = 1 Do Until EOF(1) S = Input(I, #1) Delay 0.1 '延遲0.1秒 Label1 = Label1 & S LoopEnd SubSub Delay(ByVal N!) '延遲副程式 Dim T1!, T2! T1 = Timer Do T2 = Timer If T2 < T1 Then T2 = T2 + 86400 DoEvents Loop Until T2 - T1 > NEnd Sub
2006-09-20 15:34:29 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
Private Sub Form_Activate()Text1.Text = ""Dim a() As Byte, b As StringReDim a(FileLen("c:\test.txt") - 1)Open "c:\test.txt" For Binary As #1Get #1, , aClose #1b = StrConv(a, vbUnicode)For I = 1 To Len(b) Text1.Text = Text1.Text & Mid(b, I, 1) Text1.SelStart = Len(Text1.Text) T1 = Timer Beep Do Until Abs(Timer - T1) > 0.1 DoEvents LoopNext IEnd Sub
2006-09-20 15:39:42 · answer #2 · answered by ? 7 · 0⤊ 0⤋