Microsoft KB Archive/162546

= FIX: ComboBox and ListBox Data Moves when Using Slide Control =

Article ID: 162546

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q162546



SYMPTOMS
Using the Slide control on the scroll bar of a dropped-down combo box or a list box causes the data in the combo box or list box to jump around erratically.



CAUSE
Setting the order on the table that is used as the RowSource property for the combo box or list box causes this behavior.



RESOLUTION
One workaround is to use an ARRAY as the RowSourceType property of the combo box or list box.

Another workaround is to use a SQL - STATEMENT as the RowSourceType. However, if the ORDER clause is used, it may be necessary to force Visual FoxPro to create an actual temporary cursor on disk of the query results. This can be done by adding a non-existing column to the resulting cursor as in the following example: SELECT ,.F. FROM  ; ORDER BY  INTO CURSOR temp



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0.



Steps to Reproduce Behavior
  Paste the following lines into a program and run it to create the necessary table: CREATE TABLE xpop (cnum c(10)) FOR i = 1 TO 5000 APPEND BLANK REPLACE cnum WITH STR(i) ENDFOR INDEX ON cnum TAG cnum NOTE: Any table can be used but this makes it easier to see.  Create a form. Add the table created above to the DataEnvironment (DE) of the form. Right-click the table in the DE to bring up the Shortcut menu. Click Properties.</li> Set the Order property of the Cursor to the index tag created above.</li>  Add a ComboBox or ListBox control to the form. Set the following properties: RowsourceType = 6 - Fields Rowsource    = "xpop.cnum" </li> Run the form.</li> Drop-down the combo box.</li> Drag the Slider control to some where in the middle of the scroll bar.</li> Click the left mouse button on the Slider control and then let up, note the contents of the drop-down jump to another place in the list and back.</li> Click the left mouse button and hold it, drag the Slider control to another location in the list and release. Notice that the data jumps to some other location.</li></ol>

<div class="references_section">