Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox changes value unexpectedly
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01103333
Message ID:
01103360
Views:
10
>I cannot seem to stop a reaction from occurring in my ComboBox. This comobox contains a dropdown lsit from an array in which it displays various resin materials. Unfortunately, when I navigate to the enxt record, and then click on the ComboBox, it changes from its original value to the previous records resin material value. At first I thought it was that I was doing an ASCAN() on the array and that this might have some affect on the next reord's resin material value. So, I copied the array which is bound to the combobox (as well as to a field in a table) to anotehr array by a similar name and then I do an ASCAN on it. I'll place the code below with a WHEN on the ComboBox as wel as a LostFocus event.
>
>ARRAY CODE IN FORM'S LOAD EVENT
>
>  SELECT PADR(ALLTRIM(Matl_Cde),6," ") + "|" + ALLTRIM(Desc), MATL_CDE ;
>    FROM C:\QUOTE\Table_L ;
>    ORDER BY MATL_CDE ;
>    INTO ARRAY ThisForm.aResinMaterial
>  *** 03/10/2006 Cecil Champenois. Copy the contents of one array to
>  *** the other.
>  ACOPY(ThisForm.aResinMaterial, ThisForm.aResMatl)
>
>

Put this into Gotfocus

* WHEN of COMBOBOX
>
>WITH ThisForm
>	*SET STEP ON
>	.cPreviousResMatlValue = Quotes.MatlCode
>ENDWITH
>
>
>LOSTFOCUS EVENT
>
>* We find out the element number of the Resin Material Code the user selected
>* from this Combo Box. Once we have the element number, we search the array to
>* obtain the description from the entire array item that the user selected.
>*SET STEP ON
>WITH ThisForm
>  IF This.Value <> .cPreviousResMatlValue
>    lnElement=ASCAN(ThisForm.aResMatl,ALLTRIM(This.Value))
>    IF lnElement <> 0
>      * Copy the Description into the Quotes table into the Matl_Desc
>      * field, if the Material Description is different than what is
>      * in the Quotes table as compared to the array item.
>      IF ALLTRIM(Quotes.Matl_Desc) <> ALLTRIM(SUBSTR(.aResMatl(lnElement),8))
>        REPLACE Quotes.Matl_Desc WITH SUBSTR(.aResMatl(lnElement),8)
>      ENDIF
>    ENDIF
>  ENDIF
>  .SaveCancelStatus()
>  This.Refresh()
>ENDWITH
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform