combobox selection problem - stuck, wrong, etc.
-
I really hope someone can offer some suggestions on this because I'm going bonkers here. I've spent days trying to hunt down this problem and I can't find it. I have two combo boxes that are populated from atlas data. The first is a list of US states and countries. Once that selection is made, the second combo box is populated with a list of the cities in the selected state or country. The code for the two is line-for-line identical - or as identical as it can be except for adding different strings. The combo box styles are identical, the event handling is identical. But one works (the state/country selection) and one has problems (the city selection). In the state/country combo box, you can press the down arrow and move through the items. In the city combo box, the selection won't move with the arrow - or rather, it appears not to move. If you accept a selection and close the dialog, you find that the selection actually did change. You only can move one position with the arrow, and only the first time you try it. After that it appears stuck. Also, when you make a selection with the mouse in the city combo box, you don't get what you select. You get a selection a few items off. The mouse selection works fine in the state/country combo box. I have been over this code a million times and I can't see why one works and the other does not. Does anyone have any idea what the problem might be? Thanks in advance.
-
I really hope someone can offer some suggestions on this because I'm going bonkers here. I've spent days trying to hunt down this problem and I can't find it. I have two combo boxes that are populated from atlas data. The first is a list of US states and countries. Once that selection is made, the second combo box is populated with a list of the cities in the selected state or country. The code for the two is line-for-line identical - or as identical as it can be except for adding different strings. The combo box styles are identical, the event handling is identical. But one works (the state/country selection) and one has problems (the city selection). In the state/country combo box, you can press the down arrow and move through the items. In the city combo box, the selection won't move with the arrow - or rather, it appears not to move. If you accept a selection and close the dialog, you find that the selection actually did change. You only can move one position with the arrow, and only the first time you try it. After that it appears stuck. Also, when you make a selection with the mouse in the city combo box, you don't get what you select. You get a selection a few items off. The mouse selection works fine in the state/country combo box. I have been over this code a million times and I can't see why one works and the other does not. Does anyone have any idea what the problem might be? Thanks in advance.
Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like
ComboBox1
andComboBox2
almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)Software rusts. Simon Stephenson, ca 1994.
-
Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like
ComboBox1
andComboBox2
almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)Software rusts. Simon Stephenson, ca 1994.
It's not practical to post the code. It's a long, complicated program. My next move will be to try to reproduce it in a test program. Maybe that will help. I was hoping someone here would have an idea of what could even cause this kind of selection problem in a combo box. I have no idea.
-
Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like
ComboBox1
andComboBox2
almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)Software rusts. Simon Stephenson, ca 1994.
I found the answer in an article on Newcomer's site: http://www.flounder.com/updatedata.htm I went through my program and commented out all instances of UpdateData(). Voila – problem gone. I may need to clean up a few problems using the control variables, but the problem that’s been driving me insane is solved. The cursor is unstuck.