What people sometimes forget is that Stack Overflow questions and answers are there not just to solve the OP's current problem at hand, it's intended as a repository of knowledge for other users of the site encountering similar problems.
The problem with linking to a dropbox or any other external resource is that they suffer from link rot leaving questions and answers pretty much useless for future users of the site.
If the code snippet is very large then sometimes there is no other alternative, however a public pastebin is probably more preferable over your dropbox. Personal websites and dropboxes are probably the most volatile places to drop code samples.
Answers that are along the lines of "Here, this will solve your problem" + link tend to be flagged and/or downvoted.
Similarly, questions that solely use external resources to provide code examples with pretty much no information tend to get flagged and closed as "Too localised".
The bottom line is that in your answer you should always describe what the code does in some reasonable detail, how and why it solves the OP's problem and ideally quote relevant snippets of code from your larger example in your answer.
This way we at least get the gist of the solution should your external resource "go away".