Say you have $1M in cash and want to spend it all buying 50,000 of a stock priced at $20, and also between when you press the button and the trade executes, the price rises to $21 per share.
What happens is your port will now contain 50,000 shares valued at $21 per share, or $1,050,000 total, but also contains -$50,000 cash.