Fórum delphi7 #396806
06/03/2011
0
If (Edit1.Text='') then
begin Application.MessageBox('Digite o Nome','Atenção', MB_ICONINFORMATION); so que se eu deixar algum edit vazio ele salva msm assim o outro que esta preenchido se souber outra forma q eu possa fazer para so salvar se todos estiverem devidamente preenchidos me ajude por favor. obrigado.
Alessandra
Curtir tópico
+ 0Posts
06/03/2011
Marco Salles
Gostei + 0
06/03/2011
Alessandra
Gostei + 0
06/03/2011
Marco Salles
Gostei + 0
06/03/2011
Alessandra
Gostei + 0
06/03/2011
Diego Macario
olha so, vc esta usando clientdataset?
pq tem uma funcao do guinther pauli onde no tfields do clientdataset vc marca a propriedade required e ele vai verificar se esta vazio o edit...
e dar uma msg amigavel
seria isso?
seria antes de salvar...
caso tenha algum marcado como required em branco ele n deixa salvar
Gostei + 0
06/03/2011
Alessandra
Gostei + 0
06/03/2011
Alessandra
Gostei + 0
06/03/2011
Marco Salles
Columns = < item Caption = 'Nome' Width = 200 end item Caption = 'Endereco' Width = 200 end item Caption = 'Cidade' Width = 100 end>
procedure TForm1.PreenCherListView; var ListItem: TListItem; // Criamos uma variável para guarda os itens do Listview begin ListItem := ListView1.Items.Add; // Adicionamos dados a Nome ListItem.Caption := edit1.text; // Adicionamos a Coluna Endereco ListItem.SubItems.Add(edit2.text); // Adicionamos a Cidade ListItem.SubItems.Add(edit3.text); end;
function TForm1.VerificarVazio(const Nome,Endereco,Rua:String):boolean;
begin
result:=True;
if Trim(Nome) = '' then
begin
showmessage('Digite o Nome');
exit;
end;
if Trim(Endereco) = '' then
begin
showmessage('Digite o Nome');
exit;
end;
if Trim(Rua) = '' then
begin
showmessage('Digite o Nome');
exit;
end;
result:=False;
end;procedure TForm1.Button1Click(Sender: TObject); begin if VerificarVazio(Edit1.Text,Edit2.Text,Edit3.Text) then PreenCherListView; end;
Gostei + 0
07/03/2011
Lu
so q msm assim ela sta salvando iguais
ond sta errado?
var
existeMatricula: Boolean;
begin
existeMatricula := False;
for i := 0 to ListView1.Items.Count - 1 do
begin
if ListView1.Items.Item[i].Caption = txtMatricula.text then
begin
existeMatricula := True;
Break;
end
end;
????????
obrigado pela ajuda com o outro codigo
Gostei + 0
07/03/2011
Marco Salles
so q msm assim ela sta salvando iguais
ond sta errado?
var
existeMatricula: Boolean;
begin
existeMatricula := False;
for i := 0 to ListView1.Items.Count - 1 do
begin
if ListView1.Items.Item[i].Caption = txtMatricula.text then
begin
existeMatricula := True;
Break;
end
end;
????????
obrigado pela ajuda com o outro codigo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)