Article ID: 206904
Article Last Modified on 5/12/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 6.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
This article was previously published under Q206904
SYMPTOMS
When you use the Microsoft Tabbed Dialog control (SP3) on a form and copy it, the control displays all of the child controls on the active tab on the resulting paste operation, but the child controls are not displayed on any other tab. The Left property is still set at a Left -75000 offset.
CAUSE
The SSTab control keeps an internal list of child controls on each tab. It also keeps a count of the child controls on each tab. If Form1 is saved and then examined in a text editor, such as Notepad, the number of controls on Tab 0 is 0 instead of 1.
The SSTab control builds a list of information about the controls contained on it, including the name of each of the controls. When the SSTab control is copied, its persisted data contains this array of control information. When the new tabctl is created by a Paste operation, the persisted data from the first control is used. The problem is that the controls that are created by Visual Basic with the second SSTab have different names than those in the persisted data: Command2 becomes Command3, and so forth. So when the SSTab tries to rebuild the controls dispid's array, it cannot find any matching names. Therefore, if the SSTab is pasted onto a different form that does not contain controls with the same names as its child controls, they all appear normal.
RESOLUTION
The workaround is to reset the Left properties of each control after the paste operation, while its parent tab is selected. This task can be simplified by placing the controls on each tab in a container control, such as a PictureBox or Frame control. Now only one control per tab must be repositioned after a paste, because the Left property of contained controls is not affected by the paste.
Another approach is to replace the SSTab control with the TabStrip control from the Microsoft Windows Common Controls.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
REFERENCES
MSDN Library Visual Studio 6.0, Index "SSTab Control," "SSTab Control - MSTab Control"
Keywords: kbbug kbtabctrl kbctrl KB206904