⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addbegin.pas

📁 管理车队用车记录
💻 PAS
字号:
unit addbegin;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TForm_addbegin = class(TForm)
    Panel1: TPanel;
    ListBox1: TListBox;
    Label3: TLabel;
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn_cancle: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn_cancleClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_addbegin: TForm_addbegin;

implementation
uses dm;
{$R *.dfm}

procedure TForm_addbegin.FormShow(Sender: TObject);
begin
edit1.Text:='';
 with form_dm.ADOTable_begin1 do
    begin
        open;
        first;
        listbox1.Items.Clear;
        repeat
            listbox1.Items.Add(fieldbyname('begin1').AsString);
            Next;
        until eof;
     end;
end;

procedure TForm_addbegin.BitBtn1Click(Sender: TObject);
begin
if edit1.text='' then
begin
  showmessage('请输入你要增加的起始地!');
  edit1.setfocus;
  abort;
end;
with form_dm.ADOTable_begin1 do
begin
  open;
  if locate('begin1',edit1.Text,[]) then
  begin
    showmessage('您要增加的起始地已经存在!');
    edit1.setfocus;
    abort;
  end;
  append;
  fieldvalues['begin1']:=edit1.Text;
  post;
end;
form_addbegin.OnShow(nil);
showmessage('增加成功!');
end;

procedure TForm_addbegin.BitBtn2Click(Sender: TObject);
begin
if listbox1.ItemIndex<>-1 then
begin
  with form_dm.ADOTable_begin1 do
  begin
    open;
    locate('begin1',listbox1.Items.Strings[listbox1.ItemIndex],[]);
    delete;
  end;
  form_addbegin.OnShow(nil);
showmessage('删除成功!');
end
else
begin
  showmessage('请选择要删除的地点!');
  abort;
end;

end;

procedure TForm_addbegin.BitBtn_cancleClick(Sender: TObject);
begin
close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -