What is your height? If you are underweight, then one cause could be genetic. If your family in general is thin and skinny, there is nothing much you can do about it. If you want to gain weight then you should try to gain weight in a healthy way. A healthy and regular meal is vital to gain or lose weight. Consuming more calories than you burn will help in gaining weight. Try to gain weight in a healthy and steady way. Eat lots of fruits and vegetables. You may consult a nutritionist and get a diet chart made which will provide you with adequate calories in a healthy way. There can be many causes which can prevent a person from gaining weight. The common causes are hyperthyroidism, diabetes, severe anemia, certain STDs, worm infestation, and certain liver disorders. If you are unable to gain weight rule out conditions mentioned above. A slow and disciplined approach will help. Do keep me posted.
Take care and regards!