Results 1 to 3 of 3

Thread: [2008] Combo problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    [2008] Combo problem

    Hello all,
    I have a bound DataGridView, displaying some columns relevant to the user, which I use to scroll up and down to display more detailed data in another area of the form relating to the row selected in the DataGridView. This works ok, except for a ComboBox on the form.
    The Combo can be populated, or not, depending on what the user wants to do with it. At the moment, the Combo can display either of two items, "ERROR" or "ADJUST" - though this will be added to at a later stage.
    What I'm finding is that if one record is set to "ERROR", when I scroll up/down in the DataGridView, every record relating to the selected row displays "ERROR" - even if the record shouldn't have anything in the Combo.
    If I update a different record, and make the contents of the Combo "ADJUST", "ADJUST" is displayed on each record until it encounters an "ERROR", at which point any record which shouldn't have anything in the Combo displays "ERROR". If I scroll back through an "ADJUST", everything which shouldn't have anything in the Combo displays "ADJUST".
    What am I doing wrong?
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [2008] Combo problem

    When you move off the selected record set the Combobox Selected item to -1 and the selected text to string.Empty
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

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

    Re: [2008] Combo problem

    Quote Originally Posted by GaryMazzone
    When you move off the selected record set the Combobox Selected item to -1 and the selected text to string.Empty
    You would set the SelectedItem to Nothing or the SelectedIndex to -1.

    The SelectedText is not relevant in this case. It behaves just like the SelectedText property of a TextBox and is not related to the items in the drop-down list at all. It's only relevant if the DropDownStyle is DropDown and event then not for a situation like this.
    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