24-06-2020, 01:44 PM
جرب هذا الكود بعد التعديل على الكود الأصلي
كود :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Menus, ComCtrls, Grids, DBGrids, DB, ADODB,
DBCtrls, Buttons, Vcl.Mask, tlhelp32, Unit2;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
label1: TLabel;
label3: TLabel;
label2: TLabel;
DBNavigator1: TDBNavigator;
button2: TBitBtn;
button1: TBitBtn;
procedure button1Click(Sender: TObject);
procedure button2Click(Sender: TObject);
private
{ Private declarations }
x: MyThread;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.button1Click(Sender: TObject);
begin
x := MyThread.Create(false);
end;
procedure TForm1.button2Click(Sender: TObject);
begin
if x <> nil then
x.terminate
end;
end;
end.

![[-]](https://delphi4arab.net/forum/D4A2020/collapse.png)