程序清單
unit Unit
interface
uses
Windows
Dialogs
type
TForm
DataSource
customerTable: TTable;
Panel
DBGrid
Panel
UpperCaseFirstAddBtn: TButton;
UpperCaseSecondAddBtn: TButton;
MixedCaseFirstAddBtn: TButton;
MixedCaseSecondAddBtn: TButton;
BitBtn
procedure ForceCase(TargetField:String;ToUpper:Boolean)
procedure UpperCaseFirstAddBtnClick(Sender: TObject)
procedure MixedCaseFirstAddBtnClick(Sender: TObject)
procedure UpperCaseSecondAddBtnClick(Sender: TObject)
procedure MixedCaseSecondAddBtnClick(Sender: TObject)
procedure FormCreate(Sender: TObject)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form
implementation
const
upper=true;
Mixed=False;
{$R *
Function IsUpper(ch:char)
begin
If (ch>=
IsUpper:=true
else
IsUpper:=False;
end;
procedure TForm
var
WorkBuffer:string;
i:Integer;
begin
with customerTable do
begin
DisableControls;
TRY
First; {將記錄指針移到第一條記錄處 }
While not EOF do
begin
WorkBuffer:=FieldByName(TargetField)
If ToUpper then
for i:=
WorkBuffer[i]:=UpCase(WorkBuffer[i])
else
begin
for i:=
If IsUpper(WorkBuffer[i]) then
WorkBuffer[i]:=chr(ord(WorkBuffer[i])+
WorkBuffer[
end;
Edit;
FieldByName(TargetField)
post;
Next;
end;
Finally
enableControls;
end;
end;
end;
procedure TForm
begin
ForceCase(
end;
procedure TForm
begin
ForceCase(
end;
procedure TForm
begin
ForceCase(
end;
procedure TForm
begin
ForceCase(
end;
procedure TForm
begin
customerTable
end;
end
雖然我們使用DBD或者在應用程序窗體中用TDBNavigator可以插入
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25168.html