Results 1 to 7 of 7

Thread: open form with occording combobox value

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    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.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: open form with occording combobox value

    Exactly what are your expectations and what are the results you get?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    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.

  6. #6
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: open form with occording combobox value

    try
    Code:
    ComboBox.SelectedItem = "ALL"
    if "ALL" is in the collection of items.
    Prefix has no suffix, but suffix has a prefix.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: open form with occording combobox value

    Then set the SelectedItem property, not the Text property.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width