Fórum Combobox Dinâmico #397339
16/03/2011
0
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, OleCtrls, PdfLib_TLB, Mask, Buttons; type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label3: TLabel;
Edit1: TEdit;
Pdf1: TPdf;
Button1: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1;
Data: TDateTime; implementation {$R *.dfm} procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9',#8,#13]) then
begin
key:= #0;
end; if key = #13 then
button1.Click;
end; procedure TForm1.Button1Click(Sender: TObject);
var mArquivo: String; begin
if Edit1.Text = '' then
begin
ShowMessage('Documento não encontrado na pasta '+ComboBox1.Items[ComboBox1.ItemIndex]);
exit;
end;
// Abre o PDF
Screen.Cursor := crHourGlass;
if (Edit1.GetTextLen = 1) then
mArquivo := '00' + Edit1.Text + '.pdf'
else if (Edit1.GetTextLen = 2) then
mArquivo := '0' + Edit1.Text + '.pdf'
else
mArquivo := Edit1.Text + '.pdf';
mArquivo := copy(ComboBox1.Items[ComboBox1.ItemIndex],6,2) + copy(ComboBox1.Items[ComboBox1.ItemIndex],1,2) +'\' + mArquivo;
Pdf1.Visible:= true;
if not FileExists (mArquivo) then
begin
Pdf1.Visible := false;
ShowMessage('Documento não encontrado na pasta '+ComboBox1.Items[ComboBox1.ItemIndex]); end
else
Pdf1.LoadFile(mArquivo); Edit1.Focused;
Screen.Cursor := crDefault; end; procedure TForm1.Edit1Change(Sender: TObject);
begin
if Edit1.Text = '' then
begin
Pdf1.Visible := False;
end;
end;
end. Desde já, agradeço pela atenção dispensada. Obrigado!!!
Natanael Ferreira
Curtir tópico
+ 0Posts
16/03/2011
Wilson Junior
Espero ter colaborado.
Gostei + 0
16/03/2011
Marco Salles
DateTimePicker2.MinDate:=IncYear(date,-1); uses DateUtils;
Gostei + 0
16/03/2011
Marco Salles
DateTimePicker2.MinDate:=IncYear(date,-1); uses DateUtils;
Gostei + 0
16/03/2011
Natanael Ferreira
DateTimePicker2.MinDate:=IncYear(date,-1); uses DateUtils;
Gostei + 0