VB问题:如何使一个记事本文件的内容在VB的text控件中显示?
1个回答
展开全部
请设置TEXT的属性MultiLine为True:
Option Explicit
Dim str1 As String
Dim str As String
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1 = ""
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Input #1, str1
str = str & str1 & Chr(13) & Chr(10)
Text1 = str
Loop
Close #1
End Sub
Option Explicit
Dim str1 As String
Dim str As String
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1 = ""
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Input #1, str1
str = str & str1 & Chr(13) & Chr(10)
Text1 = str
Loop
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询