Ive made a really small class object in a unit (no form)
Type TQICheck = class
Private
MessageString: String;
procedure CheckQValid;
procedure CheckIValid;
Public
constructor Create;
destructor Destroy; override;
function QMessageMe: String;
function IMessageMe: String;
End;
2 public functions to return me a message string based on calculations within the private procedures.
constructor TQICheck.Create;
begin
inherited Create;
MessageString := '';
end;
destructor TQICheck.Destroy;
begin
inherited Destroy;
end;
From another form when I click a button
procedure TForm_Main.TBB_QMessagesClick(Sender: TObject);
var
OutputString: string;
MyMessage: TQICheck;
begin
MyMessage.Create;
OutputString := MyMessage.QMessageMe;
MessageDlg(OutputString, mtInformation, [mbOK], 0);
end;
Everything seems ok to me but obivously Im missing a basic line or something if I want free/destroy it (through the application)
When I shutdown my App I get lots of access violations.
I havent put any other code into the program apart from this.
Can someone tell me what I need to handle this correctly
procedure TForm_Main.TBB_QMessagesCl
var
OutputString: string;
MyMessage: TQICheck;
begin
MyMessage := TQICheck.Create; // not MyMessage.Create;
OutputString := MyMessage.QMessageMe;
MessageDlg(OutputString, mtInformation, [mbOK], 0);
end;