VB怎么读取指定得文本内容

来源:百度知道 编辑:UC知道 时间:2024/09/18 05:38:29
现在我有两个文本第一个内容如下:
b
ba
ban
bang 帮
bo 波
bu 不
第二个是:
b 3
ba 1
ban 1
先读第一个文本,当遇到字母后面没有文字得时候,就读取第二个文件里的内容。也就是当读第一个文本读b时候就后面没有文字,就读第二个文本里得
b 3
就是当读到字母后面没有文字得时候,就读第二个文本内对应字母后得内容
这是我编的代码:
Private Sub Command1_Click()
Dim aa As String
Dim i As Long, j As Long
Open App.Path + "\wang.txt" For Input As #1
While Not EOF(1)
Line Input #1, strLine
z = z & strLine & vbCrLf
Wend
Close #1
Open App.Path + "\li.txt" For Input As #1
While Not EOF(1)
Line Input #1, cc
f = f & cc & vbCrLf
Wend
Close #1
aa = z & f & vbCrLf
bb = Split(aa, vbCrLf)
For i = 0 To UBound(bb)
If Asc(Right(bb(i), 1)) > 0 Then
For j = 0 To UBound(bb)
If Left(bb(j), Len(bb(i)) + 1) = bb(i) & " " Then
Text1.Text = Text1.Text & bb & vbCrLf
End If
Next j
Else
End

Open 文本1地址 For Input As #1
Do While Not EOF(1)
Line Input #1, str1
Text1.Text = Text1.Text + str1
Loop
Close #1
Open 文本2地址 For Input As #1
Do While Not EOF(1)
Line Input #1,str2
Text1.Text = Text1.Text +str2
Loop
Close #1

不清楚你的问题,你的问题是不是当读到后面的文字不是字母的时候就读第二个本中的内容啊