The VGA ports on computers can only send signals out to display devices, not receive. So, what you're proposing will not work.
I've seen this software advertised as being able to allow multiple computers to be controlled by one keyboard and one mouse: Synergy
It's free, so it might be worth a try.
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.