■ [PREP] PREP -ing
You use in with a present participle to indicate that when you do something, something else happens as a result.
- In working with others, you find out more about yourself.
■ while doing something or while something is happening, and as a result of this.
- In all the confusion, it is quite possible that some people got tickets without paying.
- In my excitement, I forgot all about the message.
─ in doing sth
- In trying to protect the queen, Howard had put his own life in danger.
■ while doing sth; while sth is happening.
- In attempting to save the child from drowning, she nearly lost her own life.
- In all the commotion I forgot to tell him the news.
.... Cobuild, LDOCE, OALD
Dic. En. Prep. Participle.