You would want to gain weight through building muscle with putting on little fat as possible. Try eating alot of protein, and look into some supplements (Creatine, Glutamine, Protein). Muscle does not come overnight, you need patience, gaining weight fast is usually a result of eating extra carbs and retaining water, or eating everything in site and gaining fat weight. Gaining pure muscle takes longer but at least you gain something that is healthy and functional. I almost forgot, train using the basic exercises, bench press, squats, etc. These are more mass movements and will help you get bigger more efficiently, if you are a beginner let someone help you learn these movements.