J
jfhyn
Unregistered / Unconfirmed
GUEST, unregistred user!
读取数据,跟踪时 生成树时半途出错。
这个错误,只是有时候运行时出现,大部分情况下却不会出现。
错误为:类名:TcxTreeView异常:参数不正确。
trvZhxm.Items.Clear;
try{try}
strList := TStringList.Create;
strList.Clear;
strList.Sorted := True;
trvZhxm.Items.begin
Update;
Q_zhxm.First;
while not Q_zhxm.Eofdo
begin
Index := strList.IndexOf(Trim(Q_zhxm.FieldByName('ZXKS').AsString));
Case Index of
-1:
begin
root_node := trvZhxm.Items.Add(nil,Trim(Q_zhxm.FieldByName('ZXKS').AsString));
trvZhxm.Items.AddChild(root_node,Q_zhxm.FieldByName('ZHXMMC').AsString);
strList.AddObject(Trim(Q_zhxm.FieldByName('ZXKS').AsString),root_node);
end;
else
trvZhxm.Items.AddChild(TTreeNode(strList.Objects[Index]),
Q_zhxm.FieldByName('ZHXMMC').AsString);
end;
Q_zhxm.Next;
end;
finally
trvZhxm.Items.EndUpdate;
//trvZhxm.Items.
strList.Free;
end{try};
这个错误,只是有时候运行时出现,大部分情况下却不会出现。
错误为:类名:TcxTreeView异常:参数不正确。
trvZhxm.Items.Clear;
try{try}
strList := TStringList.Create;
strList.Clear;
strList.Sorted := True;
trvZhxm.Items.begin
Update;
Q_zhxm.First;
while not Q_zhxm.Eofdo
begin
Index := strList.IndexOf(Trim(Q_zhxm.FieldByName('ZXKS').AsString));
Case Index of
-1:
begin
root_node := trvZhxm.Items.Add(nil,Trim(Q_zhxm.FieldByName('ZXKS').AsString));
trvZhxm.Items.AddChild(root_node,Q_zhxm.FieldByName('ZHXMMC').AsString);
strList.AddObject(Trim(Q_zhxm.FieldByName('ZXKS').AsString),root_node);
end;
else
trvZhxm.Items.AddChild(TTreeNode(strList.Objects[Index]),
Q_zhxm.FieldByName('ZHXMMC').AsString);
end;
Q_zhxm.Next;
end;
finally
trvZhxm.Items.EndUpdate;
//trvZhxm.Items.
strList.Free;
end{try};