Сделать атрибутом класса?
Код:
type
TForm1 = class(TForm)
...
private
FMyVariable : String;
end;
...
procedure TForm1.FormCreate(...);
begin
FMyVariable := '1';
end;
procedure TForm1.CloseQuery(...);
begin
If ComboBox1.Text <> FMyVariable Then
CanClose := MessageDlg(...) = mrYes;
end;