I have some very strange issues with combo boxes on a tab control.
Here's the scenario: I have a Windows Forms form that has a tab control
on it, with two (2) tabs. Tab 2 happens to have a number of text and
combo boxes on it (in panels on the tab). These combos were originally
simple drop down lists - i.e. you had to select from the list and
couldn't enter anything of your own. At that time everything worked
fine.
Now, the users decided that they wanted to be able to enter text into 6
of these combo boxes, and not be forced to select only from the list.
No problem, I thought, I simply switched the combo boxes from
DropDownList to DropDown (the commit/update logic didn't have to be
changed, thank goodness). When I load the boxes initially, I simply
read the database, load the items into the combo box collection, then
take whatever is specifed for this database record and set that in the
combo box Text field. That worked fine, EXCEPT for this one wierd
occurance: When you switch to that tab, ALL of these six combo boxes I
switched over to DropDown have their text selected! All are highlighted
and if I write a keypress event for one of these combo boxes, it shows
the selectedlength to be that of the length of the text - i.e. it is as
though a .SelectAll was done on each of these combo boxes; yet I never
do that anywhere in my code! I can un-select them by tabbing thru each
combo box - but then if I switch back to tab 1 and then back to tab 2,
lo and behold, every one of these combo boxes are reselected again!
I have banged my head against a wall trying to figure out why it is
doing this, but to no avail. I've went thru the code and don't see
anything that would account for this. I know my users are going to
complain if I put this into production acting like this. Anyone got any
ideas as to what .NET is doing and how to fix it? I don't know if this
is something stupid I am doing and just not seeing, or whether this is
an issue with the control and/or .NET framework.
Any advice/thoughts appreciated. BTW, this is being done in VS 2003,
..NET Framework 1.1, and Windows Forms.
Thanks in advance.
Tom
--