What are Valence electrons and how does the electron dot diagram work?

I need to know how it works.
like how the stuff changes from and atom to a ion and then from that to a compound.
a site for it might be nice =]
4 answers