VB 编程 将txt 指定行数据 显示在 textbox 中

创建一个 command1 创建一个text1
点击 command1 就在 text1 中显示 C:\1.txt 中的第二行
谢谢了 本人菜鸟 学习中
Private Sub command1_click()
Dim a As String 定义字符串变量a
Dim aa As String定义字符串变量aa

Open "d:\1.txt" For Input As #1 以读的方式打开该文件

Line Input #1, a 按行读该文件 赋值给a
Line Input #1, aa 按行读该文件 赋值给aa

Close #1
Text1.Text = aa
End Sub

Private Sub command1_click()
Dim a As String
Dim aa As String
Open "c:\1.txt" For Input As #1
Line Input #1, a '按行读的意思 将第一行赋给a
Line Input #1, aa

Close #1
text1.text=aa
end sub
温馨提示:答案为网友推荐,仅供参考