1. She has a secret in growing vegetables.

2. Do you know how she grows vegetables well?
3. It is to talk and sing to the vegetables.
4. Why is she a good farmer?
5. Because she grows vegetables well by talking and singing to them.
6. What secret does she have in raising vegetables well?
7. Her secret is to talk and sing to the vegetables.
8. She has a secret that she talks and sings to the vegetables.
[Would you check the sentences above? Which ones are ungrammatical? Thank you.]

1. If you use "for" instead of "in," this sentence will be fine.

2, 3, and 4 are fine.
5 is a fragment, not a complete sentence. To correct this, remove "Because" at the beginning.
6. See #1.
7 is fine.
8 is incorrect. If you remove "that" and insert a colon (:) after "secret" it'll be correct. Or you could remove "that" and make this into two sentences.

The sentences you provided are grammatically correct except for sentence 8, which is ungrammatical. It can be revised as follows: "She has a secret: she talks and sings to the vegetables."