用VB制作一个简单记事本问题!

2024-12-23 04:30:26
推荐回答(1个)
回答1:

Private Sub cmd_Open_Click()
Dim FileN$, FreeF%, T$
cmd_dlg.Filter = "文本文件(*.txt)|*.txt"
cmd_dlg.CancelError = True
On Error GoTo endsub
cmd_dlg.ShowOpen
FreeF = FreeFile
FileN = cmd_dlg.FileName
Open FileN For Input As FreeF
Line Input #FreeF, T
a_txt.Text = T
Do Until EOF(FreeF)
Line Input #FreeF, T
a_txt.Text = a_txt.Text + vbNewLine + T
Loop
Close FreeF
endsub:
End Sub