See example VFP: Use edit box control to do a "touch prize machine"

Source: Internet
Author: User
Tags touch

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.