Fórum listview #396878
07/03/2011
0
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;
????????
Alessandra
Curtir tópico
+ 0Posts
07/03/2011
Marco Salles
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;
function TForm1.VefificarItem(List:TListView;caption:String): boolean; var i:Integer; begin result:=(False); for i := 0 to List.Items.Count-1 do if List.Items.Item[i].Caption = caption then begin result:=True; Break end; end;
procedure TForm1.Button1Click(Sender: TObject); begin if VerificarVazio(Edit1.Text,Edit2.Text,Edit3.Text) then if not VefificarItem(ListView1,edit1.Text) then PreenCherListView; end;
Gostei + 0
08/03/2011
Alessandra
begin
if ExisteMatricula(txtMatricula.Text) then
ShowMessage('Matrícula já existe!')
else
//Sua rotina para salvar a matrícula
;
end;
so q sta dando erro ao chamar
Gostei + 0
08/03/2011
Alessandra
begin
if ExisteMatricula(txtMatricula.Text) then
ShowMessage('Matrícula já existe!')
else
end;
so q sta dando erro ao chamar
Gostei + 0
08/03/2011
Marco Salles
begin
if ExisteMatricula(txtMatricula.Text) then
ShowMessage('Matrícula já existe!')
else
//Sua rotina para salvar a matrícula
;
end;
so q sta dando erro ao chamar
Gostei + 0
08/03/2011
Alessandra
function ExisteMatricula(Matricula: string): Boolean;
var
x: integer;
begin
Result := False;
for x := 0 to ListView_Funcionario.Items.Count - 1 do
begin
if ListView_Funcionario.Items.Item[x].Caption = Matricula then
begin
Result := True;
Break;
end
end;
e pra chamar a função assim
begin
if ExisteMatricula(txtMatricula.Text) then
ShowMessage('Matrícula já existe!')
else
//Sua rotina para salvar a matrícula
;
end;
Gostei + 0
08/03/2011
Marco Salles
function ExisteMatricula(Matricula: string): Boolean; var x: integer; begin Result := False; for x := 0 to SeuForm.ListView_Funcionario.Items.Count - 1 do begin if SeuForm.ListView_Funcionario.Items.Item[x].Caption = Matricula then begin Result := True; Break; end end;
Gostei + 0
09/03/2011
Alessandra
no private do form ainda ñ sei cm se faz, ainda ñ xegamos nessa part na aula, fiz uma pesquisa no google + as rspostas ñ foram claras, se puder me falar cm fazer eu agradasço muito
Gostei + 0
09/03/2011
Marco Salles
no private do form ainda ñ sei cm se faz, ainda ñ xegamos nessa part na aula, fiz uma pesquisa no google + as rspostas ñ foram claras, se puder me falar cm fazer eu agradasço muito
var
x: integer;
begin
Result := False;
for x := 0 to SeuForm.ListView_Funcionario.Items.Count - 1 do
begin
if SeuForm.ListView_Funcionario.Items.Item[x].Caption = Matricula then
begin
Result := True;
Break;
end
end; , SeuForm >>>> É o Nome do Form .. Form1 por exemplo Colocar no Private do Form é somente a DECÇARAÇÃO Por exemplo type
TForm1 = class(TForm)
private function ExisteMatricula(Matricula: string): Boolean; //AQUI A DECLARAÇÃO
{ Private declarations }
public
{ Public declarations }
end; Apos isto colocque o Cursor Sobre a Declaração e de simultaneamente Um CNTR+SHIFT+C o DELPHI abrira para vc a parte da IMPLEMENTAÇÃO
function TForm1.ExisteMatricula(Matricula: string): Boolean; var x: integer; begin Result := False; for x := 0 to ListView_Funcionario.Items.Count - 1 do begin if ListView_Funcionario.Items.Item[x].Caption = Matricula then begin Result := True; Break; end end;
Gostei + 0
09/03/2011
Alessandra
muito obrigada
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)