...
type
TString = class(TObject)
private
fStr: String;
public
constructor Create(const AStr: String) ;
property Str: String read FStr write FStr;
...
constructor TString.Create(const AStr: String);
begin
inherited Create;
FStr := AStr;
end;
Proses ke combobox nya :
-------------------------------
cbDealer.Properties.Items.Clear;
with DM.Q do
begin
Close;
SQL.Text := 'select KD_DEALER,NAMA_DEALER from t_faktur'+
' where DATE_FORMAT(tgl_faktur, ''%Y%m%d'') between :tgl and :tgl2 group by KD_DEALER order by KD_DEALER';
Params[0].AsString := FormatDateTime('yyyymmdd',dt.Date);
Params[1].AsString := FormatDateTime('yyyymmdd',dt2.Date);
Open;
if DM.Q.RecordCount > 0 then
begin
while not eof do
begin
cbDealer.Properties.Items.AddObject(Fields[1].AsString,TString.Create(Fields[0].AsString));
Next;
end;
end
else
begin
cbDealer.Properties.Items.AddObject('SEMUA DEALER',TString.Create('ALL'));
end;
end;
cbDealer.Text := '';
.......
Penggunaan pada saat combobox di pilih adalah sebagai berikut:
params() := TString(cbDealer.Properties.Items.Objects[cbDealer.ItemIndex]).Str;
Tidak ada komentar:
Posting Komentar