千
千中元
Unregistered / Unconfirmed
GUEST, unregistred user!
控件应该是在用户输入完成后,自动为输入的内
容加上一个前缀。代码很简单:
TmyDBwaterBook = class(TDBEdit)
private
{ Private declarations }
FPrefixion : String;
procedure SetPrefixion(Value:String);
protected
procedure DoExit;override;
{ Protected declarations }
public
constructor Create(AOwner:TComponent);override;
{ Public declarations }
published
property Prefixion : String read FPrefixion write SetPrefixion;
//可以这样理解:prefixion的值是通过读FPrefixion而来,
//而FPrefxion是通过setPrefixion来赋值;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Md', [TmyDBwaterBook]);
end;
{ TmyDBwaterBook }
constructor TmyDBwaterBook.Create(AOwner: TComponent);
begin
inherited create(Aowner);
end;
procedure TmyDBwaterBook.DoExit;
begin
inherited;
if pos(FPrefixion,text)<>1 then
text:=text+FPrefixion;
end;
procedure TmyDBwaterBook.SetPrefixion(Value: String);
begin
Fprefixion:=Value;
end;
end.
安装,在测试程序里对delphi带的数据库进行操作
在formcreate时候,Table1.edit;
测试中出现两种情况的错误
.错误一:出现unkown Database: Alias:try
错误二:在输入的时候Recordlocked by another user
table:/try/locate/B.db
user qian
容加上一个前缀。代码很简单:
TmyDBwaterBook = class(TDBEdit)
private
{ Private declarations }
FPrefixion : String;
procedure SetPrefixion(Value:String);
protected
procedure DoExit;override;
{ Protected declarations }
public
constructor Create(AOwner:TComponent);override;
{ Public declarations }
published
property Prefixion : String read FPrefixion write SetPrefixion;
//可以这样理解:prefixion的值是通过读FPrefixion而来,
//而FPrefxion是通过setPrefixion来赋值;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Md', [TmyDBwaterBook]);
end;
{ TmyDBwaterBook }
constructor TmyDBwaterBook.Create(AOwner: TComponent);
begin
inherited create(Aowner);
end;
procedure TmyDBwaterBook.DoExit;
begin
inherited;
if pos(FPrefixion,text)<>1 then
text:=text+FPrefixion;
end;
procedure TmyDBwaterBook.SetPrefixion(Value: String);
begin
Fprefixion:=Value;
end;
end.
安装,在测试程序里对delphi带的数据库进行操作
在formcreate时候,Table1.edit;
测试中出现两种情况的错误
.错误一:出现unkown Database: Alias:try
错误二:在输入的时候Recordlocked by another user
table:/try/locate/B.db
user qian