[求助]如何动态生成菜单项,谢谢!!
根据数据库里的数据库表如何生成菜单!!!谢谢
procedure Tf_main.N10Click(Sender: TObject);
var
i:integer;
begin
with adoquery1 do
begin
close;
sql.Clear ;
sql.Add('select * from owner');
open;
begin
ADOQuery1.First ;
for i:=1 to ADOQuery1.RecordCount do
begin
MainMenu1.Items[10].Add(TMenuItem.Create(self));
MainMenu1.Items[10].Items[i-1].Name := 'N_10_' + IntToStr(i);
MainMenu1.Items[10].Items[i-1].Caption := ADOQuery1.FieldByName('o_name').AsString;
MainMenu1.Items[10].Items[i-1].OnClick := myclick;
ADOQuery1.Next;
end;
end;
end;
end;
end.
错在哪里?急啊!!!