Finding component by name or type (Button, TextBox or other)?

  • Thread starter Thread starter Alessandro Francisco
  • Start date Start date
A

Alessandro Francisco

I can find a component in C#, searching by name or type?

In the Delphi i'm use FindComponent(), ex:

for I := 0 to frmMain.ComponentCount - 1 do
if (frmMain.Components is TButton) then
TButton(frmMain.Components).Visible := False;

"TButton" is a component type, same to TEdit or TForm.

Did anyone understand that i mean? Please help-me!!!

tks...

Alessandro
(e-mail address removed)
C#.Net & Firebird SQL Server
 
Alessandro Francisco said:
[Delphi]
for I := 0 to frmMain.ComponentCount - 1 do
if (frmMain.Components is TButton) then
TButton(frmMain.Components).Visible := False;


foreach (Control ctl in frmMain.Controls)
{
if (ctl is Button) { /* do something */ }
}

You can also use ctl.Name to check the control's name.

P.
 
Thank you very much!



Alessandro
(e-mail address removed)
C#.Net & Firebird SQL Server
 
Back
Top