Hi Frank,
I rather guessed you might hit that problem - the 'defaultindex' is actually the row number in the combobox and, as you say, as soon as you add entries to a combobox list that is sorted, the value(country) associated with the 'defaultindex' changes.
Personally I think the 'defaultindex' should be the actual record id in the table but that's something for Dmitry to decide.
I've always got around it by doing the following:
1. In the 'country' (or whatever) table, add an extra column (I call it 'defaultcountry' (very imaginative - LOL!).
2. When you add countries to the countries table, nominate one (I use an '*') to be the default country.
3. Set your combobox to sorted.
4. Use a small script that selects the 'default' country according to which country has an '*' against it and load that into the combobox.text.
Doing it this way allows you to optionally have the first item blank (so it's not just a 'default', it's also a 'default only if you're filling in the 'country' dropdown).
But the big advantage is that your user gets to nominate what country is the default - so if someone is using your software in Canada, for example, it's now under his control and you don't have to get involved.
And obviously, you can just repeat the code in the script for as many comboboxes as you use in your application where you want to use defaults.
All of which sounds way more complicated (as usual) than it actually is - have a look at the attached example and hopefully it will be clear.
And finally, a slight amendment to the above would be to have your default country always at the top of the combobox list (overriding the alpha sort and then have all the other countries listed alphabetically) - if that's something you'd prefer, give me a shout and I can change the script accordingly.
Derek.