  We consider a non-autonomous form $\fra:[0,T]\times V\times V \to \C$ where
$V$ is a Hilbert space which is densely and continuously embedded in another
Hilbert space $H$. Denote by $\A(t) \in \L(V,V')$ the associated operator.
Given $f \in L^2(0,T, V')$, one knows that for each $u_0 \in H$ there is a
unique solution $u\in H^1(0,T;V')\cap L^2(0,T;V)$ of $$\dot u(t) + \A(t) u(t) =
f(t), \, \, u(0) = u_0.$$ %\begin{align*} %&\dot u(t) + \A(t)u(t)= f(t)\ %&
u(0)=u_0. %\end{align*} This result by J. L. Lions is well-known. The aim of
this article is to find a criterion for the invariance of a closed convex
subset $\Conv$ of $H$; i.e.\ we give a criterion on the form which implies that
$u(t)\in \Conv$ for all $t\in[0,T]$ whenever $u_0\in\Conv$. In the autonomous
case for $f = 0$, the criterion is known and even equivalent to invariance by a
result proved in \cite{Ouh96} (see also \cite{Ouh05}). We give applications to
positivity and comparison of solutions to heat equations with non-autonomous
Robin boundary conditions. We also prove positivity of the solution to a
quasi-linear heat equation.
