VB如何选字符

来源:百度知道 编辑:UC知道 时间:2024/05/21 06:57:36
文件1.text中有:
abcd=12647
efgh=81374
ijkl=71246
.
.
如何把"="前的字符保存到数组a(),"="后的字符保存到数组b()
二楼,一执行提示下标越界..

dim linetxt as string
dim a() as string
dim b() as string
dim c() as string
Open "c:\1.txt" For Input As #1
i=0
Do While Not EOF(1)
Line Input #1, linetxt
c=Split(linetxt,"=")
redim a(i)
redim b(i)
a(i)=c(0)
b(i)=c(1)
i=i+1
Loop
Close #1

Private A(3) As String, B(3) As String, i As Long '声明需要处理的个数

Private Sub ZF(S As String)
Dim C() As String
C = Split(S, "=")
A(i) = C(0)
B(i) = C(1)
i = i + 1
End Sub

Private Sub Form_Load()
ZF "abcd=12647"
ZF "efgh=81374"
ZF "ijkl=71246"
MsgBox A(0) & " " & A(1) & " " & A(2) & Chr(10) & _
B(0) & " " & B(1) & " " & B(2)
End Sub

你在试试,我又测试了下没问题啊!不可能到你那就出问题了哦!你不要添加其他东西,就复制上面的看看