Unselectable Combobox in Tabcontrol

G

Gregory A Greenman

I have a minor, but somewhat frustrating, problem. In a program
I'm working on, I've got a tabcontrol that contains several other
controls, a few of which are comboboxes. In the IDE, one of the
comboboxes cannot be selected by clicking on it. If I click on
this combobox, the tabcontrol itself is selected. I can select
the combobox by choosing it from the list of controls in the
Properties window or by dragging a rectangle around it.

I've deleted the control and recreated it a few times. That only
solves this problem temporarily. At some point it returns.

This problem does not seem to have any effect when my program is
running. It just affects the IDE.

Does anyone have any ideas as to how to fix this problem?

I'm running MSVB.net 2003 7.1.3088 with .Net Framework version
1.1.4322 SP1.

Thanks for any help.
 
C

Cor Ligthert [MVP]

Gregory,

Did you take the first step and have a look in the designer generated code
if it is maybe still there as an orphan. If not you can as well than have a
look at the RESX file. (Make all files showable in top of project solution).

I hope this helps,

Cor
 
G

Gregory A Greenman

Cor Ligthert said:
Gregory,

Did you take the first step and have a look in the designer generated code
if it is maybe still there as an orphan. If not you can as well than have a
look at the RESX file. (Make all files showable in top of project solution).



Yeah, I had looked at the generated source code before. Other
than the attributes that I expected to be different, everything
looked the same as the other combo boxes.

I hadn't previously looked at the RESX file, but again,
everything looks the same as the other combo boxes, except the
expected differences.

Thanks,
 
G

Gregory A Greenman

Yeah, I had looked at the generated source code before. Other
than the attributes that I expected to be different, everything
looked the same as the other combo boxes.

I hadn't previously looked at the RESX file, but again,
everything looks the same as the other combo boxes, except the
expected differences.


Just to expound on this answer...

The control that I'm having a problem with is named cmbEdition.
Another combobox on the same tab page is named cmbOwner. Here's
all the generated code for the two:

--------------
#Region " Windows Form Designer generated code "
....
Friend WithEvents cmbOwner As System.Windows.Forms.ComboBox
....
Friend WithEvents cmbEdition As System.Windows.Forms.ComboBox
....

<System.Diagnostics.DebuggerStepThrough()> Private _
Sub InitializeComponent()
....
Me.cmbOwner = New System.Windows.Forms.ComboBox
....
Me.cmbEdition = New System.Windows.Forms.ComboBox
....
'
'cmbOwner
'
Me.cmbOwner.BackColor = System.Drawing.Color.FromArgb _
(CType(192, Byte), CType(255, Byte), CType(255, Byte))
Me.cmbOwner.DataSource = Me.ds.Owners
Me.cmbOwner.DisplayMember = "Description"
Me.cmbOwner.DropDownStyle = _
System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbOwner.Location = New System.Drawing.Point(512, 32)
Me.cmbOwner.Name = "cmbOwner"
Me.cmbOwner.Size = New System.Drawing.Size(128, 21)
Me.cmbOwner.TabIndex = 9
Me.cmbOwner.ValueMember = "ID"
....
'
'TabPage5
'
Me.TabPage5.Controls.Add(Me.cmbEdition)
....
Me.TabPage5.Controls.Add(Me.cmbOwner)
....
'
'cmbEdition
'
Me.cmbEdition.BackColor = System.Drawing.Color.FromArgb _
(CType(192, Byte), CType(255, Byte), CType(255, Byte))
Me.cmbEdition.Items.AddRange(New Object() _
{"First Edition", "First Edition/First Printing", _
"Stated First Edition", "First Printing", _
"First American Printing", "First American Edition"})
Me.cmbEdition.Location = New System.Drawing.Point(512, 104)
Me.cmbEdition.Name = "cmbEdition"
Me.cmbEdition.Size = New System.Drawing.Size(128, 21)
Me.cmbEdition.TabIndex = 49
....
End Sub
#End Region
--------------

And here's the contents of the ResX file for the two:


--------------
<data name="cmbOwner.DefaultModifiers"
type="System.CodeDom.MemberAttributes, System, Version=
1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="cmbOwner.Locked" type="System.Boolean,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="cmbOwner.Modifiers"
type="System.CodeDom.MemberAttributes, System, Version=
1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
....
<data name="cmbEdition.DefaultModifiers"
type="System.CodeDom.MemberAttributes, System, Version=
1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="cmbEdition.Locked" type="System.Boolean,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="cmbEdition.Modifiers"
type="System.CodeDom.MemberAttributes, System, Version=
1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
 
G

Gregory A Greenman

Just to expound on this answer...

The control that I'm having a problem with is named cmbEdition.
Another combobox on the same tab page is named cmbOwner. Here's
all the generated code for the two:


The only real difference between cmbOwner and cmbEdition is that
cmbOwner's DropDownStyle is DropDownList while cmbEdition is the
default of DropDown.

I wondered if that difference could be relevant, so I changed
cmbEdition to DropDownList and noted that the problem went away.
Doing some experimenting, I've found that this problem exists
with DropDowns, not DropDownLists. If I change a DropDown to a
DropDownList and then back again, it solves the problem until I
Exit VS and restart.

I just created a new Windows App project. I added a tab control
with two pages named A and B. I then added a combobox, left it as
a DropDown. I added a few items to its collection. Then I quit VS
and restarted. The combobox is not selectable. I repeated the
process without a tab control and the combobox is selectable.
Somehow or other VS has a bug with DropDown comboboxes in tab
controls.
 
C

Cor Ligthert [MVP]

Gregory
I have created a form
In that a tabcontrol
In that two tabpage with on both a combobox
the combobox on page 1 I have set to dropdownlist
that one I have filled with the 1,2,3,4
The other one with a,b,c,d

I have ended VS
I have started it again.
It works in my opinion as it should.

Cor
 
G

Gregory A Greenman

Cor Ligthert said:
Gregory
I have created a form
In that a tabcontrol
In that two tabpage with on both a combobox
the combobox on page 1 I have set to dropdownlist
that one I have filled with the 1,2,3,4
The other one with a,b,c,d

I have ended VS
I have started it again.
It works in my opinion as it should.



Try it with the combobox on page 1 set to DropDown. I just
modified my test project to add a DropDown on page 2 and that one
worked fine.

Apparently, the problem requires a DropDown Combo on page 1 of a
tab control. DropDown combos work fine on subsequent pages and
DropDownLists work fine anywhere.

BTW, my version numbers are:

MS Development Environment 2003 Version 7.1.3088
MS Net Framework 1.1 Version 1.1.4322 SP1
 
M

Mick Doherty

I can confirm this behaviour. You can select the combobox by clicking on the
button but clicking on the edit box results in the TabControl being
selected.

I just tried the same thing with TabControlEX (my modified tabcontrol with a
custom designer), and clicking on the edit box will toggle between selecting
the combobox and selecting the tabcontrol. I also tried it with a new
control I am working on, which does not inherit TabControl but is a similar
control, and that does not exhibit this behaviour, so I can safely say that
this is a TabControl specific issue and not something to do with container
collection controls.
 
G

Gregory A Greenman

<EXCHANGE#[email protected].[mdaudi100
#ntlworld.com]> declared...
I can confirm this behaviour. You can select the combobox by clicking on the
button but clicking on the edit box results in the TabControl being
selected.

I just tried the same thing with TabControlEX (my modified tabcontrol with a
custom designer), and clicking on the edit box will toggle between selecting
the combobox and selecting the tabcontrol. I also tried it with a new
control I am working on, which does not inherit TabControl but is a similar
control, and that does not exhibit this behaviour, so I can safely say that
this is a TabControl specific issue and not something to do with container
collection controls.



Thanks. I was beginning to wonder if I was seeing things.

I hadn't noticed that clicking on the button correctly selects
the combobox. That helps alot because using a selection rectangle
or choosing the control in the properties window is kind of a
nuisance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top