回复 2楼 apull
这段代码 ,单独可以过,但是 到我这边还是提示下标越界,我是从文本文件中 ,line input 读入的,粘贴到论坛后tab变成了空格,用空格可以分拆,读文件用空格就不行了,用tab("\t")
也不可以。
PUMPFILE = App.Path & "\技术参数\" & "is型水泵资料.GDT"
global_PUMPFILE = PUMPFILE
Open CStr(global_PUMPFILE) For Input As #1 Len = -1
Input #1, global_Rowsnum, global_Colsnum, str1, str2
Line Input #1, global_ShuoMing1
Line Input #1, global_ShuoMing2
var_4C = global_PumpNum
For i = 1 To global_PumpNum Step 1
'写序号
Line Input #1, global_Shuju
'MsgBox global_Shuju
' Gridshuju = Split(global_Shuju, "\t", -1, 0)
'数据分解,UBound(global_Gridbiaotilan),-1
返回所有字符串,1
按执行文字比较,\t,\根据TAB 进行分割
' MsgBox Replace(global_Shuju, " ", "_")
'Gridshuju = Split(Replace(global_Shuju, " ", "_"), "_", -1, 0)
'数据分解,UBound(global_Gridbiaotilan),-1
返回所有字符串,1
按执行文字比较,\t,\根据TAB 进行分割
Gridshuju = Split(Trim(global_Shuju), "\t")
s = ""
For k = 0 To UBound(Gridshuju)
If Len(Gridshuju(i)) > 0 Then
s = s + Gridshuju(i) + " "
End If
Next k
Gridshuju = Split(Trim(s), " ")
查询界面.ziliao1.TextMatrix(i, 0) = CStr(i)
MsgBox Gridshuju(1) & Gridshuju(2)
For j = 1 To UBound(Gridshuju) Step 1
'LBound 函数与 UBound 函数一起使用,用来确定一个数组的大小。UBound 用来确定数组某一维的上界。
查询界面.ziliao1.TextMatrix(i, 1) = Gridshuju(j)
Next
Next
Close #1
[此贴子已经被作者于2023-10-7 20:44编辑过]