柳
柳树林
Unregistered / Unconfirmed
GUEST, unregistred user!
1。我想让窗体启动后edit1获得焦点,出了下面的错
cannot focus a disabled or invisible window
源代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
DBGrid1: TDBGrid;
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.SQL.Clear;
ADOquery1.SQL.Add('select * from ww_duty where du_id='+edit1.Text+' and du_come like '+''''+edit2.Text+'%''' );
showmessage('select * from ww_duty where du_id='+edit1.Text+' and du_come like '+''''+edit2.Text+'%''');
adoquery1.Open ;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
selectnext(activecontrol,true,true);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.SetFocus;
end;
end.
2。还有SQL中查询两个字段A1长度15(CHAR),A2(DATETIME)格式
如何通过A1的后四位,A2的前十位查询。用Tquery,Tadoquery都可以
3。在ini文件中有id1=...,id2=...,id3=... ...... 如何在程序初始时写入combobox列表里
4。我昨晚编译了一个程序,今天拿到公司,运行没有反应。。。。气死我了
不好意思。。。新来的,分不多
谢谢各位大侠!!!
cannot focus a disabled or invisible window
源代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
DBGrid1: TDBGrid;
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.SQL.Clear;
ADOquery1.SQL.Add('select * from ww_duty where du_id='+edit1.Text+' and du_come like '+''''+edit2.Text+'%''' );
showmessage('select * from ww_duty where du_id='+edit1.Text+' and du_come like '+''''+edit2.Text+'%''');
adoquery1.Open ;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
selectnext(activecontrol,true,true);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.SetFocus;
end;
end.
2。还有SQL中查询两个字段A1长度15(CHAR),A2(DATETIME)格式
如何通过A1的后四位,A2的前十位查询。用Tquery,Tadoquery都可以
3。在ini文件中有id1=...,id2=...,id3=... ...... 如何在程序初始时写入combobox列表里
4。我昨晚编译了一个程序,今天拿到公司,运行没有反应。。。。气死我了
不好意思。。。新来的,分不多
谢谢各位大侠!!!