Chemical Combination- It's because of the electrostatic forces of attraction between atoms having opposite charges or it may due to sharing the electrons.
In chemistry, an element has a chemical property known as it's combining capacity. Other terms that mean the same thing are valence and valence electrons. This is an indication to how many bonds this element will provide in an effort to bond chemically with another element to produce a compound. Another way to look at it is the number of valence electrons available to provide bonds with another element's outer electron shell. For example, the element carbon has a combining capacity of 4, meaning it has the capacity to make 4 bonds to other atoms of elements. It has this property due to the fact it has four single electrons in it's outer electron shell.
So no.of valence electrons=Combining capacity