📄 manul.pas
字号:
unit manul;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, db, XPMenu;
type
TmanulForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
edtname: TEdit;
edtphone: TEdit;
edtfamily: TEdit;
edtoffice: TEdit;
edtdorm: TEdit;
edtlt: TEdit;
edtmilitary: TEdit;
caozuomemo: TMemo;
btn: TBitBtn;
btncancel: TBitBtn;
BitBtn3: TBitBtn;
procedure BitBtn3Click(Sender: TObject);
procedure btncancelClick(Sender: TObject);
procedure btnClick(Sender: TObject);
private
{ Private declarations }
procedure operatefun;
public
{ Public declarations }
end;
var
manulForm: TmanulForm;
implementation
uses datamodule, setunit, Unit1;
{$R *.dfm}
procedure tmanulform.operatefun;
begin
with dm.ADOD do
begin
FieldByName('姓名').AsString:=edtname.Text;
FieldByName('手机').AsString:=edtphone.Text;
FieldByName('家庭电话').AsString:=edtfamily.Text;
FieldByName('办公室电话').AsString:=edtoffice.Text;
FieldByName('宿舍电话').AsString:=edtdorm.Text;
FieldByName('小灵通').AsString:=edtlt.Text;
FieldByName('军线').AsString:=edtmilitary.Text;
FieldByName('备注').AsString:=caozuomemo.Text;
post;
end;
end;
procedure TmanulForm.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure TmanulForm.btncancelClick(Sender: TObject);
begin
if manulform.Caption='添加' then
edtname.Text:='';
edtphone.Text:='';
edtfamily.Text:='';
edtoffice.Text:='';
edtdorm.Text:='';
edtlt.Text:='';
edtmilitary.Text:='';
caozuomemo.Text:='';
edtname.SetFocus;
end;
procedure TmanulForm.btnClick(Sender: TObject);
begin
if edtname.Text='' then
begin
application.MessageBox('请输入姓名 ','提示',mb_ok or mb_iconerror);
edtname.SetFocus;
exit;
end;
if manulform.Caption='添加' then
begin
if dm.ADOD.Locate('姓名',edtname.Text,[loCaseInsensitive]) then
begin
application.MessageBox('通讯录中已经存在该姓名 ','添加',mb_ok or mb_iconerror);
btncancelClick(Sender);
exit;
end
else
if setform.cbadd.Checked=true then
if application.MessageBox('确定要添加该记录吗? ','添加',mb_yesno or MB_ICONQUESTION)=mryes then
begin
begin
dm.ADOD.insert;
operatefun;
btncancelClick(Sender);
end;
end
else
exit
else
begin
dm.ADOD.insert;
operatefun;
btncancelClick(Sender);
end;
end;
if manulform.Caption='修改' then
if setform.cbadd.Checked=true then
if application.MessageBox('确定修改该记录信息吗?','修改',mb_yesno or MB_ICONQUESTION)=mryes then
begin
dm.ADOD.edit;
operatefun;
application.MessageBox('修改成功 ','修改',mb_ok or MB_ICONEXCLAMATION);
end
else
exit
else
begin
dm.ADOD.edit;
operatefun;
end;
form1.chakan;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -