当我调试的时候,为什么总是出现:
”错误13,类型不匹配“
代码入下:
——————————————————————
Dim a(0 To 2) As String, b(0 To 3) As String
Private Sub OPEN_Click()
With CommonDialog1
.DialogTitle = "打开文件"
.Filter = "文本文件 (*.txt)|*.txt|所有文件|*.*"
.FilterIndex = 0
.ShowOpenOpen .FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s
a(0) = Split(s, " ")(0)
a(1) = Split(s, " ")(1)
a(2) = Split(s, " ")(2)
For i = 0 To 3
Line Input #1, b(i)
Next
Loop
Close #1
End With
MsgBox "数据读取完毕!"
End Sub
Private Sub HT_Click()
Dim a, l, h, b, b1, h1, n As Double
a = a(0)
l = a(1)
h = a(2)
b = b(0)
b1 = b(1)
h1 = b(2)
n = b(3)
End Sub
”错误13,类型不匹配“
代码入下:
——————————————————————
Dim a(0 To 2) As String, b(0 To 3) As String
Private Sub OPEN_Click()
With CommonDialog1
.DialogTitle = "打开文件"
.Filter = "文本文件 (*.txt)|*.txt|所有文件|*.*"
.FilterIndex = 0
.ShowOpenOpen .FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s
a(0) = Split(s, " ")(0)
a(1) = Split(s, " ")(1)
a(2) = Split(s, " ")(2)
For i = 0 To 3
Line Input #1, b(i)
Next
Loop
Close #1
End With
MsgBox "数据读取完毕!"
End Sub
Private Sub HT_Click()
Dim a, l, h, b, b1, h1, n As Double
a = a(0)
l = a(1)
h = a(2)
b = b(0)
b1 = b(1)
h1 = b(2)
n = b(3)
End Sub
a = a(0)
b = b(0)
下面这几句俺不懂
a(0) = Split(s, " ")(0)
a(1) = Split(s, " ")(1)
a(2) = Split(s, " ")(2)应改成:
a = Split(s, " ")