I would like to remove Ubuntu from my Virtualbox and install it again because it's not working properly so I would like to reinstall it. I wanted to know if there is a way to uninstall it and keep all the files that I already created since it's a lot of files. Thank you!
The thing virtualbox is good in is having more than one instances.
So ... create the NEW instance and do not remove the old one. Add a second adapter set to host-only on both guests and you can copy files over from old to new until you are satisfied.
And then remove the old instance.
Also for future reference: when your virtualbox setup is good enough for you make a backup of it each time you start something you are unsure of (like update, upgrades, install software, messing with configurations).
You can't keep files in a reinstall unless your /home folder is on a separate partition from the root. If you didn't use a custom partition structure during install, then all you can do is backup the files you want to keep and restore them after the reinstall.
In VirtualBox, load an Ubuntu Live disc image into the Virtual CD drive and start up your virtual machine. It should boot into a live version of Ubuntu. From there, you should be able to access your filesystem and backup the files you want to keep onto a USB drive.
My best advice is creating a /home partition. In this way you only have to change your system files (/ partition) and doesn't loose any files(or profiles like Firefox).
This topic has a good answer for you to do it.