主题:急!!!高手帮忙调下程序!
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure FillFields();
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses data;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FillFields;
end;
procedure TForm1.FillFields;
var
i:integer;
begin
DataModule1.ADOQuery1.Active:=true;
ListBox1.Items.Clear;
for i:=0 to DataModule1.ADOQuery1.FieldCount-1 do
begin
ListBox1.Items.Add(DataModule1.ADOQuery1.Fields[i].FieldName);
end;
//确保LISTBOX中选项被选中
ListBox1.Selected[0]:=true;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure FillFields();
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses data;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FillFields;
end;
procedure TForm1.FillFields;
var
i:integer;
begin
DataModule1.ADOQuery1.Active:=true;
ListBox1.Items.Clear;
for i:=0 to DataModule1.ADOQuery1.FieldCount-1 do
begin
ListBox1.Items.Add(DataModule1.ADOQuery1.Fields[i].FieldName);
end;
//确保LISTBOX中选项被选中
ListBox1.Selected[0]:=true;
end;
end.