ComboBox Index Change on TabControl

stewarts
04-08-2003, 08:38 AM
I have a TabControl with 2 TabPages on my form. TabPage1 contains a ComboBox (dropdownstyle = dropdownlist) that is bound to a database table. I want the ComboBox to be blank upon form initialization, so I set the ComboBox.SelectedIndex to -1. The ComboBox is blank when the form is initialized, but when I click over to TabPage2 and back to TabPage1, the SelectedIndex on the ComboBox is reset to 0. If I actually choose a value in the ComboBox and then switch to TabPage2 and back, the selected value remains unchanged. How can I get the ComboBox.SelectedIndex to remain at -1 until a selection is made? Thanks in advance for your assistance!!!!

BankCop
04-08-2003, 12:01 PM
I have a TabControl with 2 TabPages on my form. TabPage1 contains a ComboBox (dropdownstyle = dropdownlist) that is bound to a database table. I want the ComboBox to be blank upon form initialization, so I set the ComboBox.SelectedIndex to -1. The ComboBox is blank when the form is initialized, but when I click over to TabPage2 and back to TabPage1, the SelectedIndex on the ComboBox is reset to 0. If I actually choose a value in the ComboBox and then switch to TabPage2 and back, the selected value remains unchanged. How can I get the ComboBox.SelectedIndex to remain at -1 until a selection is made? Thanks in advance for your assistance!!!!

Is this a Tabstrip control or an SSTab control?

stewarts
04-08-2003, 12:08 PM
I have a TabControl with 2 TabPages on my form. TabPage1 contains a ComboBox (dropdownstyle = dropdownlist) that is bound to a database table. I want the ComboBox to be blank upon form initialization, so I set the ComboBox.SelectedIndex to -1. The ComboBox is blank when the form is initialized, but when I click over to TabPage2 and back to TabPage1, the SelectedIndex on the ComboBox is reset to 0. If I actually choose a value in the ComboBox and then switch to TabPage2 and back, the selected value remains unchanged. How can I get the ComboBox.SelectedIndex to remain at -1 until a selection is made? Thanks in advance for your assistance!!!!

Is this a Tabstrip control or an SSTab control?

It's the "TabControl" that was included in the Visual Studio .NET toolbox with the initial load. It's on the .NET Framework Components list. Thanks!

BankCop
04-08-2003, 12:13 PM
I have a TabControl with 2 TabPages on my form. TabPage1 contains a ComboBox (dropdownstyle = dropdownlist) that is bound to a database table. I want the ComboBox to be blank upon form initialization, so I set the ComboBox.SelectedIndex to -1. The ComboBox is blank when the form is initialized, but when I click over to TabPage2 and back to TabPage1, the SelectedIndex on the ComboBox is reset to 0. If I actually choose a value in the ComboBox and then switch to TabPage2 and back, the selected value remains unchanged. How can I get the ComboBox.SelectedIndex to remain at -1 until a selection is made? Thanks in advance for your assistance!!!!

Is this a Tabstrip control or an SSTab control?

It's the "TabControl" that was included in the Visual Studio .NET toolbox with the initial load. It's on the .NET Framework Components list. Thanks!

.Net questions should be asked on that forum!

However, you might try setting a form level variable to hold the selected index and reset it to that variable each time the tab changes. Don't forget to reset the variable when the selection changes.

Flyguy
04-08-2003, 12:19 PM
http://www.dotnetforums.net

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum