The extended partition can't be changed unless its inner partitions are changed first. In your case the swap partition is in the way, which you would have to resize (or simply just delete it in your case, you can easily recreate it or use a swap file instead).
A common problem is that the swap partition can't be moved/removed because it's still mounted and used, in such a case you need to turn off that it's being used as a swap partition (e.g. using
swapoff), no reboot required.
(It might be also worth noting that the extended partition stuff is not needed anymore when using the GPT partition scheme instead of MBR. Note that GPT is commonly used in conjunction with UEFI, whose support in VirtualBox used to be quite lacking, but from what I heard it improved in more recent versions.)