What is the code for how to add data to a table using a form in VFP
Right-click in the form and select "Data Environment..." to select the table you want.
Then enter the following code in the "Add" button:
SELECT situation table
IF ALLTRIM(THISFORM.text1.VALUE)=''
=MESSAGEBOX ('Please enter your name and other information', 48, 'Message prompt')
RETURN
ENDIF
IF MESSAGEBOX ('Please check carefully to ensure that the entered information is complete and accurate! ' CHR(13) CHR(13) 'Are the above information correct?', 48 4, 'Information prompt') =6
APPEND BLANK
REPLACE Name WITH THISFORM.text1.VALUE, Gender WITH THISFORM.text2.VALUE
REPLACE home address WITH THISFORM.text3.VALUE, date of birth WITH THISFORM.text4.VALUE
REPLACE mobile phone WITH THISFORM.text5.VALUE,QQ WITH THISFORM.text6.VALUE
REPLACE ZIP CODE WITH THISFORM.text7.VALUE,E_mail WITH THISFORM.text8.VALUE
REPLACE Zodiac WITH THISFORM.text9.VALUE, Nationality WITH THISFORM.text10.VALUE
REPLACE NOTE WITH THISFORM.text11.VALUE
STORE '' TO THISFORM.text1.VALUE,THISFORM.text2.VALUE,THISFORM.text3.VALUE
STORE '' TO THISFORM.text4.VALUE,THISFORM.text5.VALUE,THISFORM.text6.VALUE
STORE '' TO THISFORM.text7.VALUE,THISFORM.text8.VALUE,THISFORM.text9.VALUE
STORE '' TO THISFORM.text10.VALUE,THISFORM.text11.VALUE
ENDIF
How to add text boxes in VFP form design. What about entering content in the list box?
Please express yourself clearly when asking questions, preferably with pictures,
1. List box, both additem and addlistitem methods can add data to the list box. The additem method can add records by index number, while the addlistitem method adds records by ID number. Use these two methods to add data. The ROWSOURCETYPE attribute value must be 0 or 1.
control.additem(cItem [,nIndex] [,nColumn]) Among them, cItem is the content of the data item to be added, and nIndex is the index number. If a valid nIndex value is specified, the cItem will be placed at the correct position in the control; if the specified nIndex already exists, the data item will be inserted at this position, and all other data items after this data item will be in the combo box or list box control. Move down one position in the list area. nColumn will specify the column to which the data item is to be added. The default value is 1.
The syntax of the addlistiem method is as follows
control.addlistiem(cItem [,nItemID] [,nColumn])
Among them, cItem and nColumn are the content of the data item to be added and the column to be added. nItemID is the unique ID number of the data item to be added. If the specified nItemID already exists, use cItem to overwrite the content of the current ID data item.
2. Text box
thisform.text1.value="Hello"
Add the above using commands, or you can add it directly
You can set the data type of the text box,
thisform.text1.value=""&Set to character type
thisform.text1.value=0 & set to numeric type
thisform.text1.value={} & set to date type
About VFP data import issues
DECLARE INTEGER ShellExecute IN shell32.DLL INTEGER HWND,STRING,STRING lpszFile, STRING, STRING, INTEGER
eole=CREATEOBJECT('Excel.application')
eole.Workbooks.Open(KKKK) & Open the specified workbook
**eole.visible=.t. & Show Excel window
eole.visible=.F. & Do not display the Excel window
eole.selection.WrapText = .T.
xlSheet=eole.Sheets(1)
i=1
***Note: Variable I can be the first row or the Nth row. It is up to the user to decide which row the data starts from.
XMH=xlSheet.Cells(I,1).value
***The current data in EXECL is the first column, which can be modified to any N columns
IF TYPE('XMH')'C'
***Note: Determine whether it is a character type. If it is a numeric type, replace 'C' with 'N'
=MESSAGEBOX ('Item number is not character data! Cannot be loaded', 0, 'Prompt message')
eole.ActiveWorkbook.Close(.T.)
eole.Workbooks.close & Close workbook
eole.quit & Exit Excel
RETURN
ENDIF
DO WHILE !EMPTY(XMH)
***When the variable XMH is empty, the reading program ends
SELE SVC
*** SVC is the target table and can also be used as a table with other names
APPE BLAN
REPL project number WITH TRIM(XMH)
***Item number is the target field
XMMC=xlSheet.Cells(I,1).value
I=I 1
XMH=xlSheet.Cells(I,1).value
IF TYPE('XMH')='C'
ELSE
=MESSAGEBOX ('Item number is not character data! Cannot be loaded', 0, 'Prompt message')
eole.ActiveWorkbook.Close(.T.)
eole.Workbooks.close & Close workbook
eole.quit & Exit Excel
RETURN
EXIT
ENDIF
ENDDO
eole.ActiveWorkbook.Close(.T.)
eole.Workbooks.close & Close workbook
eole.quit & Exit Excel
The above is the detailed content of How to write the code to add data to the form in VFP form?. For more information, please follow other related articles on the PHP Chinese website!

If your PC runs on an AMD chipset, you may receive the “Windows Update may have automatically replaced AMD” error message when using it. Don’t worry! This post from php.cn provides some solutions for you.

What is Microsoft Sway and what is PowerPoint? These two are different presentation tools to facilitate people’s working and studying. So, what’s the difference between them and how choose between them. This post on php.cn Website will give you some
![[Must-Know] Win 10 Offline Installer: Install Win 10 22H2 Offline](https://img.php.cn/upload/article/001/242/473/174490855357657.png?x-oss-process=image/resize,p_40)
Is there any Windows 10 offline installer for you to install the latest Windows 10 offline or without the internet? Of course, yes. php.cn Software shows you how to get a Windows 10 offline installer in this post.

Some users report that they meet the Windows Server auto-shutdown issue after the license expires. This post from php.cn teaches you how to stop expired Windows Server auto-shutdown. Now, keep on your reading.

Are you struggling with the “the file can’t be displayed” error when accessing the specific folder? Some users are complaining about this trouble and looking for useful measures. This article about the file can’t be displayed OneDrive from php.cn wil

Street Fighter 6 is a fighting game published by Capcom and belongs to the Street Fighter franchise that has attracted a bunch of game fans. Some people hope to play this game on PCs. To do that, you need to meet some Street Fighter 6 system requirem

Drive names (volume labels) are displayed before the drive letters by default in Windows. Do you know how to show drive letters before drive names? This post from php.cn tells you how to show drive letters first in File Explorer.

The language bar is useful for a multilanguage Windows user. You can change the language by simply clicking. Some people want to turn off/on the language bar on the taskbar. Do you know how to do it? If you don’t know, read this php.cn post to find p


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor