1

I'm trying to reorder tabs at runtime (preferably by hitting a button that sorts them alphabetically by name). I have several buttons and text boxes on the tabs that I need to make sure come along. I'm mostly self taught with coding, so I'm not sure what other details to include. I'll provide any other items as needed.

The closest I got to reordering at runtime was using this: How to easily reorder TabControl?

The issue here is that I have several buttons, labels, and textboxes that do not come along when using this.

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
MKE
  • 11
  • 2
  • 1
    If the buttons, labels, and textboxes "don't come along", are you sure they're actually on (children of) the tab page? – ProgrammingLlama Aug 15 '21 at 15:33
  • This question might help to identify if they are actually on that tab page: https://stackoverflow.com/questions/34058912/c-sharp-winform-accessing-controls-in-a-usercontrol-from-every-tab-page – Luuk Aug 15 '21 at 15:34
  • If you mean you're successfully swapping the tabs but it's not updating until you manually switch the current tab to a different one and back, it seems that a `protected` method called `UpdateTabSelection` needs to be called. If this is your issue, it could be done by creating a derived TabControl class. Alternatively, you could store the `SelectedIndex` in a temporary variable, set the tabControl's SelectedIndex to -1, and then set it back to the original value, which would also trigger this method to run. – ProgrammingLlama Aug 15 '21 at 15:52
  • 1
    You didn't provide any code, reproducible example and even the technology you use. – György Kőszeg Aug 15 '21 at 19:39

0 Answers0