Hi christing,
我根据你的代码进行了测试,
测试结果:

没有发现错误,所以我们需要关于你遇到的问题的更多信息。
关于 MessageBox的部分,你遇到了什么问题呢?
期待你的更新。
Best Regards,
Xingyu Zhao
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.