with ADOQuery3 do
向14个组合框添加同一个表的同个字段的所有值。
注: 该form中一共有16个组合框,combobox1~14是添加同一个表的同个字段的所有值。 另两个可不能加上述的值。 我是个菜鸟
错误信息
Variable 'i' might not have been initialized
FOR-Loop variable 'i' may be undefined after loop begin
try
open;
while not eof do
begin
for i := 0 to cyba1.componentcount-1 do
begin
if components[i].classtype = TCombobox then
begin
Tcombobox(Components[i]).Items.Add(FieldByName('caimin').AsString);
end;
end;
next;
end;
first; Tcombobox(Components[i]).text := Tcombobox(Components[i]).items[0];
except
end;
end;
end;
向14个组合框添加同一个表的同个字段的所有值。
注: 该form中一共有16个组合框,combobox1~14是添加同一个表的同个字段的所有值。 另两个可不能加上述的值。 我是个菜鸟
错误信息
Variable 'i' might not have been initialized
FOR-Loop variable 'i' may be undefined after loop begin
try
open;
while not eof do
begin
for i := 0 to cyba1.componentcount-1 do
begin
if components[i].classtype = TCombobox then
begin
Tcombobox(Components[i]).Items.Add(FieldByName('caimin').AsString);
end;
end;
next;
end;
first; Tcombobox(Components[i]).text := Tcombobox(Components[i]).items[0];
except
end;
end;
end;
解决方案 »
- SQL Server 2005 有什么优势,
- 急啊,idftp问题
- 急,,SQL SERVER 2000 数据库备份问题!!
- 请教Form之间传递参数有什么好方法
- 急!!!关于用indy pop 控件接收邮件问题,高手请帮忙!!
- ADOStoredProc中用execproc执行存储过程后,是否能得到返回的结果记录集?
- 提个老问题:不用控件用ADO分别给出连接MDB和SQL7.0或者SQL2000的方法,多谢多谢各位大侠!
- 简单的数据库的问题,还望指教!
- 请问如何编程序修改paradox库的密码?
- 如何在自定义函数的单元文件中添加USES后就错了?
- 为广大编程爱好者提供软件发布平台
- 大家帮忙看看错在哪儿
中的i不能这样用
procedure TForm1.Button1Click(Sender: TObject);
var
i:Integer;
YourComponentIndex:Integer;
begin
try
Table1.Open;
Table1.first;
while not Table1.eof do
begin
for i := 0 to Self.componentcount-1 do
begin
if components[i].classtype = TCombobox then
begin
Tcombobox(Components[i]).Items.Add(Table1.FieldByName('NAME').AsString);
YourComponentIndex := i;
end;
end;
Table1.next;
end;
//Table1.first;
//Tcombobox(Components[i]).text := Tcombobox(Components[YourComponentIndex]).items[0];
except
Self.Caption := '哈哈,出错啦!!!';
end;
end;