Fórum Propriedade Name de Label #182381
16/09/2003
0
Como capturar o número da Propriedade Name de um TLabel ou um TImage?
Propriedade Name: Label58 (só o 58 por exemplo)
Tentei assim mas não deu!
var
strLabel:string;
begin
strLabel:=TLabel(FindComponent(´Label´+inttostr($d))).name;
end;
Propriedade Name: Label58 (só o 58 por exemplo)
Tentei assim mas não deu!
var
strLabel:string;
begin
strLabel:=TLabel(FindComponent(´Label´+inttostr($d))).name;
end;
Ilaera
Curtir tópico
+ 0
Responder
Posts
16/09/2003
Adriano Santos
procedure TForm1.Button1Click(Sender: TObject);
var
strLabel : String;
I : Integer;
Function SomenteNumero(Texto : String ) : String ;
Var
x,i : Integer ;
xTexto : String ;
Begin
Result := ´´ ;
{Retorna Somente os Numeros de uma String}
For i:=1 to Length(Texto) do
Begin
Try
If not (Texto[i] in [´0´..´9´]) then
Continue ;
x := StrToInt(texto[i]) ;
Result := Result + IntToStr(x);
Except
End;
End;
End;
begin
for I := 0 to Form1.ComponentCount-1 do begin
if Components[I] is TLabel then begin
strLabel := ´Nº do LAbel ´+ TLabel(Components[I]).Name + ´: ´ +
SomenteNumero(TLabel(Components[I]).Name);
ListBox1.Items.Add(strLabel);
end;
end;
end;
var
strLabel : String;
I : Integer;
Function SomenteNumero(Texto : String ) : String ;
Var
x,i : Integer ;
xTexto : String ;
Begin
Result := ´´ ;
{Retorna Somente os Numeros de uma String}
For i:=1 to Length(Texto) do
Begin
Try
If not (Texto[i] in [´0´..´9´]) then
Continue ;
x := StrToInt(texto[i]) ;
Result := Result + IntToStr(x);
Except
End;
End;
End;
begin
for I := 0 to Form1.ComponentCount-1 do begin
if Components[I] is TLabel then begin
strLabel := ´Nº do LAbel ´+ TLabel(Components[I]).Name + ´: ´ +
SomenteNumero(TLabel(Components[I]).Name);
ListBox1.Items.Add(strLabel);
end;
end;
end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)