Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo box (Requery)
Message
 
 
À
22/10/2001 23:35:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00571968
Message ID:
00571986
Vues:
21
Hi!

If you meant that you have a value in thje ControlSource field that is not in the drop-down list in the combobox, it is not simple. VFP will not display it if it is not in list. There are 2 solutions for this.

1. Put 2 controls - textbox and combobox. Combobox is resized to the wdith of combobox arrow only and put to right from texbox. You display value in the textbox that is usually read-only. In combobox you can select value and in the Valid event of the combobox assign selected value to the textbox. ControlSource is assigned for textbox only. Leave ControlSource of combobox empty and set its TabStop property to .F., as well as move focus to textbox after selection in combobox. This simulates work of 2 controls as a single one, with your own functionality. You can make it as a class by putting both textbox and combobox into the container.

2. In the Refresh event of the combobox check if current value is in the list. If it is not in the list, you can use AddItem or AddListItem methods of combobox to add the absent item to the combobox list. You can do this for most row sources include the view or query. You can make new item added disabled. Later you can remove it in the Refresh event when recod in main alias moved and so ControlSource field value is changed. To refresh combobox to display new item from list from the Refresh event, use "combobox.ControlSource=combobox.ControlSource" assignment. All other ways will cause marking of the field in ControlSource as changed that can cause some weird or unpredictable results that are hard to debug.

HTH.

>Hi guys!
>
>
>I have a in a form combobox and the rowsource is an alias(teamgroup) created from a remote view. Everytime I edit a record from the form and change the corresponding value of the combobox, I update the table(teamgroup.used)to (.T.)
>Then I start to requery the remote view(teamgroup). The view has a parameter that will only requery all records with teamgroup.used = .F.)
>
>Everytime I requery the table, the expected results should be those with (teamgroup.used = .F.). This exclude the record that I previously edited because I updated its used field to .T.
>
>the problem is that initial value of the combobox is not displayed anymore rather, it displays an empty value.
>
>any advice or help will be greatly appreciated.
>
>Thanks in advance...
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform