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
以上代码都不全,这里也写不下,如果你想看,去我博客VB里看有完整的VB记事本代码还有抓图记事本界面设计的抓图,可根据抓图来设置你的界面 http://hi.baidu.com/angelnofly/blog/item/0d7e866de07ac9ff42169473.html记事本的代码部分 http://hi.baidu.com/angelnofly/blog/item/245f80c7debf83d8d0006073.html