Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting default value in drop-down list
Message
From
11/08/1998 22:31:03
Chris Crachiolo
Blackmoor Associates Incorporated
New York City, New York, United States
 
 
To
11/08/1998 16:07:22
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00124990
Message ID:
00125851
Views:
30
>>I've got an unbound combo box (Style = 2, dropdown list) with RowSourceType = Value (RowSource is a comma-delimited list of values). What I want to do is display the first item in the list as a default value, but no matter what I try, a value doesn't appear until the list is dropped down and a value is selected. I have both Value and DisplayValue set to the desired value in the form designer, and I verified at runtime -- via the command window -- that these properties do indeed contain the values I set in the form designer, but it still doesn't display until a value is explicitly selected from the list, not even when I call the control's refresh method.
>>
>>Anybody know a way around this?
>You could set the value manualy ie cboXXXXX.Value = "FooBar". This can be done in any of various methods available on the form ( ie ThisForm.Init method ). However, I have found that unless the value you are putting into the control matches "exactly" one of the choices the object will show as blank. My first course would be to triple check this. Then if that fails and you can't figure out anything else force it with the cbo.Value method.
>
>Hope this helps
>Terry

Thanks for the advice. I already got it to work by putting THIS.LISTINDEX = 1 in the INIT of the control, as suggested by another UT member.
"Ignorance more frequently begets confidence than does knowledge."
-- Charles Darwin
"I am invincible! Invincible...OWWWWWWWW!"
-- Homer Simpson
Previous
Reply
Map
View

Click here to load this message in the networking platform