Related Pages
Delphi Tips and Code
- Starting email client
- Starting default browser
- Starting applications
- Connecting to / disconnecting from network
Delphi Applications

Delphi Tips and Code

Clear all edits on your form

Sometimes you have a form that has a large number of edits. To reset this you could use the following code for each edit:

Mainform.Edit1.text := '';

With 30 edits on the form this is a little untidy. However by using the following code you can set them all to blank with only three lines of code attached to a button on the form. This technique can be applied to many situations where you need to process a large number of controls on your form.

procedure TMainForm.Button1Click(Sender: TObject);
var
   I: integer;
begin
   for i:= MainForm.ControlCount - 1 downto 0 do
      if (MainForm.Controls[i] is TEdit) then
          (MainForm.Controls[i] as TEdit).Text := '';
end;


  • Home
  • |
  • Sitemap
  • |
  • Databases
  • |
  • Web development
  • |
  • Delphi development
  • |
  • Image manipulation
  • |
  • KaSaB
  • |
  • Contact