Failure to keep your invention secret prior to filing your patent application could well result in your patent not being granted or render it ineffective even if it is granted.
When should I file my patent application?
You must file your application before there has been any non-confidential disclosure of the invention and certainly before you intend to exploit it commercially. If you are not in a position to exploit your invention commercially then it is advisable to file your application before approaches are made to any person or company.

