vb读取txt,如何读取指定行的第五个字符后的本行剩余内容

来源:百度知道 编辑:UC知道 时间:2024/05/09 16:05:06
vb读取txt,如何读取指定行的第五个字符后的本行剩余内容

Dim A As String, T As Integer
A = "ABCDEFGHIJK"
T = Len(A)
A = Right(A, T - 5) '截取A第五个字符后的本行剩余内容
Label1.Caption = A
Label1.Caption输出的是“FGHIJK”

dim s as string
open "c:\.....txt" for input as #1
line input #1,s
s=mid(s,6)
msgbox s
close #1

Private Sub cmdOpen_Click() '确定文本文件的总行数
Dim str As String
Dim str1 As String
Dim NextLine As String
Dim Txt_sj As String
Dim l As Integer
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
l = l + 1
Loop
Close
Text3 = l
End Sub

Private Sub Command1_Click() '查看文本文件的指定行的内容
Dim str As String
Dim str1 As String
Dim NextLine As String
Dim Txt_sj As String
Dim l As Integer
Dim n As Integer
n = InputBox("读