The Mexican-American War lasted from 1846 to 1848, and most of it was all about Texas. Once Texas declared that it was independent from Mexico, they elected Sam Houston as their first President. This all changed in 1845 when Texas was accepted as the 28th state of the United States.