Perhaps calculations like this?
(* values for parameters*)
numbers = {g -> 9.8, theta -> 40 Degree, v0 -> 100.};
(* the time when the projectile hits the ground *)
tFinal = 0;
(* equations, including initial and termination conditions *)
eqs = {y''[t] == -g, y'[0] == v0 Sin[theta], y[0] == 0, x''[t] == 0,
x'[0] == v0 Cos[theta], x[0] == 0,
WhenEvent[y[t] < 0, {"StopIntegration", tFinal = t}]};
(* solution, asks for more time than needed *)
sol = NDSolveValue[eqs /. numbers, {x[t], y[t]}, {t, 0, 50}];
trajectory = ParametricPlot[sol, {t, 0, tFinal}]