zlmyongheng 发表于 2011-10-4 13:11:08

请高手看一下,为什么脚本运行会出错

请高手看一下,为什么脚本运行会出错

Global $tab1_view,$treeview1


$tab1_view=GUICtrlCreateTreeViewItem("a",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("b",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("c",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("d",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("e",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("f",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("g",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("h",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("i",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("j",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("k",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("l",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("m",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("n",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("o",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("p",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("q",$TreeView1)
$tab1_view=GUICtrlCreateTreeViewItem("r",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("s",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("t",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("u",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("v",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("w",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("x",$tab1_view)
$tab1_view=GUICtrlCreateTreeViewItem("y",$tab1_view)

编译错误提示信息如下:
$tab1_view=GUICtrlCreateTreeViewItem("y",$tab1_view)
^ ERROR


明明声明了25个变量,为什么提示最后一个出错
当把上面
Global $tab1_view 改成
Global $tab1_view
就不提示出错了
但这样我后面的很多功能都实现不了了
是不是数组维数有问题
帮助中哪边有数组的详细介绍。




还有一错误也是
If StringLeft($dir_number[$i],StringLen($dir_prefix))= $dir_prefixThen
MsgBox(0,"提示",StringLeft($dir_number[$i],StringLen($dir_prefix)))
Endif

也提示错误
If StringLeft(^ ERROR


变量都声明了

zlmyongheng 发表于 2011-10-4 13:12:31

用ubound测试也是25,为什么编译就出错

happytc 发表于 2011-10-4 13:48:41

数组下标是从0开始的
25个,代表:$tab1_view,$tab1_view,.....,$tab1_view

魔导 发表于 2011-10-4 13:50:48

哎~~~~这个偶不懂   帮顶{:1_498:}{:1_498:}

zlmyongheng 发表于 2011-10-4 16:25:31

本帖最后由 zlmyongheng 于 2011-10-4 16:26 编辑

可不可以定义从1开始,

learn321 发表于 2011-10-4 16:47:39

回复 5# zlmyongheng


    可以将数组定义为$tab1_view,从1开始使用,$tab1_view空置,也许就可以吧

jj119120 发表于 2011-10-4 18:15:18

又见到这个想当鸡的……   不怕封号么

xms77 发表于 2011-10-4 19:32:04

3楼正解!{:face (396):}

gzh888666 发表于 2011-10-4 22:56:17

一般让他返回一个数组的数量

tsui 发表于 2011-10-4 23:17:23

可不可以定义从1开始,
zlmyongheng 发表于 2011-10-4 16:25 http://www.autoitx.com/images/common/back.gif

试试enum

zcool321 发表于 2011-10-4 23:44:29

数组下标是从0开始的
25个,代表:$tab1_view,$tab1_view,.....,$tab1_view
happytc 发表于 2011-10-4 13:48 http://www.autoitx.com/images/common/back.gif
这个说的对啊~数组都是从0开始的~你从1开始当然要少一个!要不就改变维度!!!

大叔 发表于 2011-10-8 22:38:51

3楼正解。。我也碰到过。 0带表1   25实际是24 这郁闷了我好久。如果你非用25的话就多声明一个。
页: [1]
查看完整版本: 请高手看一下,为什么脚本运行会出错