Good or bad

im eating a 32 gram protein bar a day and i run 4 at least 40 minutes will i gain weight when doing this. i only way 140lbs

Why are you running for 40 minutes if you want to gain weight? The most advantageous weight you can gain would be muscle (as opposed to fat) so you are going to have to do some sort of activity that will cause muscle growth. Strength training, sprinting, etc. would be the primary means for adding muscle. There are tons of different programs available, many of which I or CF have posted on this forum.

Also, make sure you are eating throughout the day. Lots of lean protein (chicken and fish especially) with fruits and veggies.

one bar containing 32 grams of protein is not going to make you gain weight. If you want to gain you will need more resistance training and a full out nutrition plan. 5-6 small meals throughout the day.
At the end of the day when you look at your calorie intake you want it over your calorie burn. So around 3000 calories with 25% protein, 60% carbs, and 15% fat.
There are four calories per gram of protein and you would need 750 calories from protein. So thats around 187 grams of protein per day.
Good sources of protein would be lean meats like chicken or fish, or your whey or casein protein powders. Beef is great too but you have to watch the cut and the amount of fat in the beef. Try to stay around 90% or better for the beef.
Also if you’re trying to gain weight and muscle you might have to do a little less cardio for a little bit and then slowly pick back up.