Data bound combo box

I'm trying to load a combo box with a simple table containing a number of cities. However, when I debug the program and select a city, the previous city selected changes to the current selection. For example:

My list is Vancouver, Montreal and Ottawa, in that order. If I select Ottawa, and then hit the pulldown box again, my list becomes Ottawa, Montreal and Ottawa. If I then select Montreal, my list becomes Ottawa, Montreal and Montreal.

Has anyone seen this yet and if so, do they know how to fix it I'm a VB newbie, so this may be something simple that I'm overlooking.

Thanks in advance.



Answer this question

Data bound combo box

  • Benjamin Wagner

    I'm havin a similar problem where I have a database where one field is called State. I enter the state postal codes into the combobox at design time, but when I press save button during run time it doesn't save the state's code in the appropriate record. I have now all but one saving the right code.

    During the add record on the navigation control, I have:

    statecombobox.selectedindex = 0

    so that the initial value is shown when the add record button is click, thus showing that all controls go back to default values. This value then shows up as one value in one of the records.

    Btw, I created the single record view using the completely automated datasource thing that puts all the controls on the form and binds them automatically.

    I also tried messing with the databinding props in order to fix, but one record continues to use the first value in the combobox.

    Please help me.

  • Sven_Dataelektronik

    Can someone tell me how to bind data through a combobox while I have states listed in the items list

  • ElG

    The obvious thing to do would be to post your code, so we can see what's going on.

     



  • Khairun Jamal

    Unfortunately, there really isn't any code to post. I created the combobox and bound the data from the database to it. At this point, I haven't even tried to do anything with the item I selected.
  • m_armstrong

    Sounds to me like your code to set the initial selection is always being called ( is this a website, if so, this code should be in a !IsPostback block, so it only happens the first time ).

     



  • Data bound combo box