The edit box control is similar to the text box control, and you can actually think of it as a text box that can display multiple rows of data, a scroll bar for a long amount of data, and most of its properties and events are similar to text boxes. In VFP Basic Tutorial-edit box control (EditBox) in the article has given an example, today we use the edit box to do a fun little example: Touch the prize machine. The program running interface is as follows:
This example is not complicated, mainly in the command button click event in the text box to determine the value of the input, according to the selected values entered the corresponding prizes displayed in the edit box.
The production steps are as follows:
First, create a new form, set its Caption property value to "Get started with programming Web-make a prize machine", and set the AutoCenter property value to. t.,width and Height property values are set to 280 and 150, respectively, and are saved as "touch machine. Scx".
Second, add controls and set properties:
1. Add a Label control Label1 to the form and set its Caption property value to "Please enter your selection (1-4)".
2. Add a text box control Text1 to the form, set its InputMask property value to 9,value property value set to 0.
3. Add a command button Command1 to the form and set its Caption property value to "The prize you obtained is".
4. Add an edit box control Edit1 to the form.
Third, according to the program shown above to run the interface, adjust the size of each control and the position on the form.
Iv. Add event code:
Click event code for command button Command1:
Do case case
thisform.text1.value=1
thisform.edit1.value= "Your prize is a cell phone."
Case thisform.text1.value=2
thisform.edit1.value= "Your prize is 10000 yuan."
Case thisform.text1.value=3
thisform.edit1.value= "Your prize is a learning machine."
Case thisform.text1.value=4
thisform.edit1.value= "Your prize is a color TV set."
Otherwise
thisform.edit1.value= "Thank you for your participation."
Endcase
Run "Touch the prize machine. Scx".
This example code is debugged in the win2003+vfp6.0 environment.
See the full set of "rookie also learn VFP" tutorial