Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with fairly straightforward form requirements.
Message
 
To
20/07/1999 22:37:09
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00243408
Message ID:
00243989
Views:
25
David,

Ok, let's start simple. A textbox has a Value property. When the textbox has a controlsource the value property will reflect the value of the controlsource. As a use types in teh textbox the value property changes, the value property will update the controlsource just before the Valid event fires, so in the Valid the Value and the controlsource's value are the same. Prior to the Valid the value and the controlsource may not be the same.

A combobox has both a Value and a DisplayValue property. The value property works much teh same as the textbox's value property. it will reflect the curretn value of the controlsource and it is changed by selecting osomething in the combo's list. The combo's value proeprty will be the same data type as the controlsource. The internal list that the combo uses is all character data. VFP handles the conversion for you. If you choose to read values directly form the combo's list using This.List(This.ListIndex,2) for example, then you need to do the data conversions.

When using the cobmo as a drop down combo it is possible to have a value being displayed that is not in the list. When this occurs the DisplayValue reflects what has been typed while the Value is often blank. You can use this to allow a drop down combo to add items to the list. In the Valid you check to see if DisplayValue = Value and if not, you add the DisplayValue to the list or rowsource.

As to when you want to assign adata to a value property, well whenever you want to set the value of the controlsource programmatically, or to assign a default value to the combo or list. For example, given a combo for entry of State, the two following code segments are functionally equivalent;
Thisform.Combo1.Value = "CA"
Thisform.refresh()

and

REPLACE State WITH "CA"
Thisform.refresh()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform