I am assigning a custom class with some information I need for each TabPage created:
MyClass custom = new MyClass();
TabPage tabPage = new TabPage();
tabPage.Text = ...;
tabPage.Tag = custom;
tabPage.Controls.Add(...);
Unfortunately, the moment I click between tabs, or have a context menu and click something, the Tag object is lost.
From my understanding, you can set and use whatever you want inside Tag objects, so what's the issue?
I need this to be persistent until I want it to.
The issue still persists without explanation. I even tried this post , with the same result.
Apparently, I was using a third party library that has setting "HotTrack" information as boolean (true/false) using the Tag property of the TabPages.
Removing this in the library (as I do not need it) allowed me to store my own information without getting lost or overriden.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.