I am trying to update an old VB6 application. I am struggling with changing the backcolor of the SSTab control at runtime.
I know that I cannot just set the Backcolor to the required colour.
At designtime I have created a label on each tab and then resized the label to the sstab dimensions. Then I set the label backcolor. This works fine.
However, what I really want to do is to do this at runtime so that if a new tab control is added on a form in the future I dont need to manually do this at designtime each time.
I would be grateful if someone can point me in the right direction to create and display a label on every tab of a SSTab control at runtime?
I dont have frames on all the tabs so I dont want to use the frame container to hold the label. I would rather just have the label placed on the tab container at runtime.
Thanks and I look forward to your replies.
Best Answer
As svinto says, you can load new controls to a Control Array, but there's a bit more to it than that.
Firstly the new controls are not Visible, so you must set .Visible=True You also need to set the current tab before creating the control to get it sited on that tab.
Assuming you already have the first label on the first tab:
Also, this doesn't work in the Form_Load event, but does in Form_Activate
There is another method to create the Labels from scratch rather than using a Control Array, which might be better as you don't need to add the first Label to the form: