Jump to content
  • Advertisement
Sign in to follow this  
Headkaze

[.net] ListView in TabControl event issues

This topic is 3940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This problem is pretty much driving me nuts, so I really appreciate any help on this. Google is not giving me much help. I have a TabControl on a form with a few pages. On the second page I have a ListView control. I have an method for the TabControl's ItemChecked event. In my Form_Load event I populate the ListView with data. During this time I removed the ItemChecked event ( -= ) then after looping through a list of items to add I put the ItemChecked event back ( += ). This is to stop it being triggered while adding the items. The strange thing is even though the ItemChecked event is turned off while I populate the ListView the ItemChecked event was still being triggered for each item being added to the ListView. What I realised is that it's only when I click the TabPage the ListView is on is when all these events are being triggered. So this is the confusing thing, even though I've added all these items to the ListView they are still only being added once you enter the TabPage! So it triggers all these ItemChecked events. I'm wondering if anyone has any ideas how to populate the ListView only once (on Form_Load) but have the ItemChecked event turned off so it's not triggered during this process.

Share this post


Link to post
Share on other sites
Advertisement
I ended up finding a solution to this. Strange but true, doing a TabPage.Show() before populating the ListView on the TabPage works okay :) Only took an hour to figure out!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!