Go back to your previous question:
Is there a way to assign a file path to a variable when its opened without using openfiledialog?[
^] and read the answer.
Then look at your code, and start thinking. At the moment, you are guessing what to do - and that isn't a viable development strategy.
Look at the code you show us! It won't even compile for so many reasons that it's getting silly :laugh:
And what on earth makes you assume that - even if that code did miraculously start working - all files that change will contain text-based data (i.e. data that will fit in a string)? Very little data on a computer is text: only the human readable stuff. So your MD5 (which is not recommended for new projects anyway and hasn't been for half a dozen years) method should not expect a string, it should expect an array of bytes.
Seriously: stop guessing; start thinking. This isn't difficult code, but you are doing your damnedest to make it as complicated as possible!