Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
WinTab: initial tab activation
posted

Hello,

I have created a frame (frmRGC_Interface) with a pane which is the container for a user control. I have five different user controls, each of them with a UltraTab control "tabInterface" containing the same tabs.

The parent frame (frmRGC_Interface) which contains the pane is replacing the displayed user control within the pane, so I will dispose the last used user control before I display a new one. The idea is to keep the last activated (selected) tab.

I tried to do the following:

-- in the user control's dispose event, I set a friend shared variable "frmRGC_Interface.curTab" to the key of current active tab like:
frmRGC_Interface.curTab = tabInterface.ActiveTab.Key

-- in the new event of the user control, I set the tab like:  tabInterface.Tabs(frmRGC_Interface.curTab).Active = True

 Problem: each time the NEW event is processed, the system always reactivates the first tab of tabInterface.

How can I keep the activation of a tab (or transfer the actviation status between user controls) ?

Thanks
Stephan

Parents
  • 44743
    posted

    The New method is not an event. It is a constructor which creates a new instance of your UserControl. That new instance has completely different values for its member variables (including curTab) than the previous instance of the UserControl. The value which was saved in the dispose event on the previous UserControl cannot be used in the constructor of the next UserControl. Instead, you must save this value on another class or make it a static variable instead of an instance variable.

Reply Children