Clean up after you!

From: Geir Baardsen (geir_baardsen_at_hotmail.com)
Date: 08/29/04


Date: 29 Aug 2004 09:03:55 -0700

Hi!
Can anybody tell me if I'm doing the following in a wrong way?

What I do is have a textfile loaded into a stringgrid by the help
of an OpenDialog
(it works fine, but am I cleaning up after me?,
Do I need to free the OpenDialog1?):

procedure TfrmTimeList.btnOpenFileClick(Sender: TObject);
var
MyFile : TextFile;
begin
try
  if OpenDialog1.Execute then
   begin
     AssignFile(MyFile, OpenDialog1.FileName);
      try
        LoadGrid(grTimeList,OpenDialog1.FileName);
        with grTimeList do
          begin
            FixedColor := clBtnFace;
            EditorMode := false;
              ColCount := 5;
              RowCount := 32;
              ColWidths[1] := 200;
              ColWidths[2] := 50;
              ColWidths[3] := 200;
              ColWidths[4] := 50;
          end;
    except
  on E:EInOutError do
  ShowMessage(E.Message);
  end;
  end;
  finally
  CloseFile(MyFile);
  end;
end;

:-)