  In the framework of a variational method with a single trial function an
accurate study of the lowest gerade 1g and ungerade 1u electronic states of the
molecular ion $H_2^+$ in a magnetic field is performed. Magnetic field ranges
from 0 to 4.414x10^13 G and orientations of the molecular axis with respect to
the magnetic line 0 \leq theta \leq 90 are considered. A one-parameter gauge
dependent vector potential is used in the Hamiltonian, which is finally
variationally optimized. A well pronounced minimum on the total energy surface
of the (ppe) system in both 1g and 1u states is found for all magnetic fields
and orientations studied. It is shown that for both states the parallel
configuration (theta=0) at equilibrium always corresponds to the minimal total
energy. It is found that for a given theta for both states the magnetic field
growth is always accompanied by an increase in the total and binding energies
as well as a shrinking of the equilibrium distance. We demonstrate that for
B\gtrsim 1.8x10^11 G the molecular ion can dissociate, H2+ -> H + p, over a
certain range of orientations (theta_cr \le theta \le 90), where the minimal
thetaa_cr \simeq 25 occurs for the strongest magnetic field studied,
B=4.414x10^13 G. For B<10^12 G the ion H2+ in 1g, 1u states is the most
compact, being in the perpendicular configuration (theta=90), whereas for
B\gtrsim 10^12 this occurs for an angle < 90. For the 1g state in any
orientation, with the magnetic field growth at B \sim 10^11 G, a two-peak
electronic distribution changes to single-peak one.
