Thursday, March 3, 2011

TDbComboBox doesn't change the first time it's changed.

I'm using D2009, and I have a TDbComboBox on my form, and if I click on it, then click an option from the menu, the first time I do so it doesn't change. The OnChange event handler fires, but ItemIndex remains at 0 (where it started at) instead of being updated to reflect the new item. After this first time, it works fine.

Any idea what's causing this and how I can fix it?

From stackoverflow
  • What do you see if you step through the event handler in the debugger?

    Are you doing anything funky with ItemIndex inside the event handler?

    What happens if you comment out everything in the event handler?

    Mason Wheeler : I'm not doing anything with the ItemIndex property in the event handler, and the value's supposed to have changed to reflect my new selection before the event handler fires anyway. So that's not the problem.
    _J_ : Is the underlying dataset in dsEdit/dsInsert state when you select an item from the DbCombobox? Or is the DataSource.AutoEdit property set to True?

0 comments:

Post a Comment