I ran your code ... and it works great for me. I have not changed anything (except for variable names), so I assume this is an error from VS.
As nikolamm94 said, try adding this.UpdateLayout(); at the end of connect_Click , this may help. I tried and it still works fine. Or maybe create a new VS project, it has already worked for me several times.
Sorry, my answer is not the most useful, I wanted to put a comment instead, but I do not have enough reputation: /
Flanfl
source share