I have a ListView Control in WindowsForm and also this Listivew has a checkBox I Just want one thing that when userClick on CheckBox I want this Event I used ItemCheck and ItemChecked Event but these event is firing every time even when Firstime 开发者_JAVA技巧my form is loading
The Listview control fires itemcheck and itemchecked (and some other) events sometimes at initialization, provided "by design" by Microsoft at no extra charge. You can set a flag (boolean variable) to tell whether the form has completed the loading process, and abort the handler if not.
Add the following line to the top of your event handler:
if (!this.Visible) return;
精彩评论