Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo box value
Message
From
04/07/2001 07:22:49
 
 
To
03/07/2001 17:26:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00526254
Message ID:
00526640
Views:
26
Hi Eric.

>> Is it me who didn't quite understand or the way i explained it ?!? In fact, what I want is to "force" a value in a combo box, as a display value. Example: My combo box's row source type is at "Fields" (like I said before) and I know that my combo contains a new value that we'll call "TOTO". 'Cause my combo is not set at "Value" (in this last case, we can easily say: Combobox.Value = "TOTO"), how can I say to it: "Display me TOTO" ? I thought I would see a property like "Combobox.Set" or "Combobox.Select", but it doesn't exist. To resume, how "force" a combobox to display a value that we know he has? Thanks for your patience! :o) <<

As Barbara said, if you have set a ControlSource for the combo, the combo will automatically display that is it is contained in its RowSource. If the item to which the control is bound is not in its RowSource (i.e., someone typed in a value not in the list in a combo with style = 0), you have to take action to add it to the RowSource with code similar to this in its Valid:
WITH This
 IF .ListIndex = 0 AND NOT EMPTY( .DisplayValue )
    *** Update the table used as the RowSource with the new value
    INSERT INTO < Table used in RowSource > ( < Field displayed > ) ;
      VALUES ( .DisplayValue )
    .Requery()
 ENDIF
ENDWITH
IF your combo is unbound and there is an index tag on the table used
as its RowSource, you can just SEEK the value you want in the RowSource and Refresh the combo.

Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform