It's fairly obvious that you don't really understand the code that you have taken from the internet, as you have a number of method calls that are either superfluous, or just not relevant to the problem in hand. You should spend some time studying some of the
MSDN documentation[
^] so you have at least a reasonable idea of the required sequence of events.