求要一个VB程序代码!

来源:百度知道 编辑:UC知道 时间:2024/06/28 08:58:12
读取 D:\abc.txt 字符ABC到 文本框TEXT1.text
abc.txt 内容如下:
----------------------
12345678
2345678
34567ABC812
876543
------------------
也就是读取第三行,第7,8,9列的三个字母到TEXT1.TEXT
请大家帮帮忙!

先读取行,然后用mid截取

Private Sub Command1_Click()
Open "d:\abc.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, str1
i = i + 1
If i = 3 Then Text1.Text = Mid(str1, 6, 3)
Loop
Close #1
End Sub