open form with occording combobox value
Hi All
My form VB2005 has 4 comboboxes and I would like when form is open each combobox show value ALL. I coded in LOAD procedure like this
Code:
Me.EmpComboBox.Text = "ALL"
Me.DeptComboBox.Text = "ALL"
Me.TypeComboBox.Text = "ALL"
Me.YearComboBox.Text = "ALL"
and when form is open I have other items from each list not like I expecte. What is my error?
Thanks.
Re: open form with occording combobox value
Exactly what are your expectations and what are the results you get?
Re: open form with occording combobox value
I'm expecting that each combobox will display ALL. But when form is open comboboxes display some value from own lists.
Thanks.
Re: open form with occording combobox value
Have you set the DropDownStyle properties to DropDownList? If so then the text field cannot show any value that is not in the list. Is "ALL" in the list? If not then the field can't show it.
Re: open form with occording combobox value
All comboboxes have set the DropDownStyle properties to DropDownList. And "ALL" in the list of each combobox.
Thanks.
Re: open form with occording combobox value
try
Code:
ComboBox.SelectedItem = "ALL"
if "ALL" is in the collection of items.
Re: open form with occording combobox value
Then set the SelectedItem property, not the Text property.