Small Combo / SSTab Problem

If anyone can help with this small problem, I'd be grateful.

Starting from scratch, I've created a new form, upon which I placed an SSTab control (Microsoft Tabbed Dialog Control 6.0).

On the first page of the SSTab control, I've created 2 combo boxes.

I've then coded the Form_load routine with the following, in order to add items to the combo boxes and set the text:

' Add items to combo boxes
' 1st Combo
Combo1(0).AddItem "First Item"
Combo1(0).AddItem "Second Item"
Combo1(0).AddItem "Third Item"
' 2nd Combo
Combo1(1).AddItem "First Item"
Combo1(1).AddItem "Second Item"
Combo1(1).AddItem "Third Item"

' Set text of combo boxes
Combo1(0).Text = "First Item"
Combo1(1).Text = "Second Item"

All pretty straight-forward stuff.

Problem arises when I select another tab during run-time, and then back again. The contents of all combo boxes have been high-lighted.

Is there any way to prevent this? The actual form I have created is loaded with combos, and it's quite annoying. :)
[1180 byte] By [Laurel] at [2007-11-20 11:47:25]
# 1 Re: Small Combo / SSTab Problem
You could try setting focus to one of the combo boxes when the particular tab is activated
iagina at 2007-11-9 19:32:23 >
# 2 Re: Small Combo / SSTab Problem
That sounds strange. If you click on the particular tab strip to go back where the combo boxes are, the focus is given to the tabstrip itself. So none of your combo boxes could be highlighted...
WoF at 2007-11-9 19:33:23 >
# 3 Re: Small Combo / SSTab Problem
Thanks for the suggestion.

It is a solution, but in order to clear any combos on the page, I need to set focus on each combo in turn. It's a little bit of a pain when I have so many combos in my actual application.

I would have thought that there is a reason why this is happening, and some way to prevent it?
Laurel at 2007-11-9 19:34:27 >
# 4 Re: Small Combo / SSTab Problem
No sorry i tried it. Right.
The problem being the assignment of a text to the ComboBox(n).Text property.
Try ComboBox(n).Style = 2 if that is still suitable for your needs.
WoF at 2007-11-9 19:35:27 >
# 5 Re: Small Combo / SSTab Problem
Just to clarify, when I say the text is high-lighted, I mean that the combo text is inverted, as when text is selected in a document.

Thanks for the suggestion WoF. Changing combobox.style to 2 does work, but prevents me from being able to add new lines of text to the combo, so it's not really suitable.

Any other suggestions?
Laurel at 2007-11-9 19:36:24 >
# 6 Re: Small Combo / SSTab Problem
I was afraid you wanted to enter text...

Private Sub SSTab1_Click(PreviousTab As Integer)
If SSTab1.Tab = 0 Then
Combo1(0).SetFocus
Combo1(1).SetFocus
SSTab1.SetFocus
End If
End Sub

Is the only thing I can think of ...
If you keep organizing your Combos as an array a loop is more suitable:

...
Dim i%
For i = 0 To Combo1.UBound
Combo1(i).SetFocus
Next
SSTab1.SetFocus
WoF at 2007-11-9 19:37:29 >
# 7 Re: Small Combo / SSTab Problem
Thanks once again WoF. Thats a helluva lot more precise coding that I would have done to achieve the same thing! :)

I've never used the ubound property either. You learn more everyday!!

Thanks very much!!
Laurel at 2007-11-9 19:38:32 >
# 8 Re: Small Combo / SSTab Problem
You are welcome. :) "You never cease to learn", the Germans say.

BTW.: To set the ComboBox to an item you could have also used ComboBox.ListIndex = 2 instead of setting the .Text property, but that would still end you up with the highlighted items.
WoF at 2007-11-9 19:39:30 >
# 9 Re: Small Combo / SSTab Problem
Thanks WoF.

I coded the text into the combo as I did because in my actual application, the text is not always an item in the combo box.
Laurel at 2007-11-9 19:40:27 >