Search This Blog

Clearpage Code

THISFORM.Text1.VALUE = ""
THISFORM.Command1.VALUE = ""
THISFORM.Pageframe1.VALUE = ""
THISFORM.Grid1.VALUE = ""
THISFORM.Combo1.VALUE = ""

Report Code

Calling a report from a form is very easy. You can even call a multiple reports that comes from your application. Microsoft Visual FoxPro is very flexible, you do not have to install other application in making print reports. VFP 's built in reports can call view from a table either local or through local area connection such as SQL from a server.

txtName = ALLTRIM(THISFORM.txtName.VALUE)
txtBirthDate = ALLTRIM(THISFORM.txtBirthDate.VALUE)
txtBirthPlace = ALLTRIM(THISFORM.txtBirthPlace.VALUE)
REPORT FORM "C:\ProjectName\Reports\Resume" TO PRINTER PROMPT NODIALOG PREVIEW

Edit Save Code

Microsoft Visual FoxPro programming language has a lot of code to edit, insert, replace or save. Using select, append, insert or replace is some of the ways to save data. I always use the select and replace because it is easy to troubleshoot when your code has a problem.

SELECT InfoNumber
LOCATE FOR IdNum = THISFORM.txtIdNum.VALUE
IF FOUND()
SELECT InfoNumber
REPLACE LastName WITH ALLTRIM(THISFORM.txtLastName.VALUE)
REPLACE FirstName WITH ALLTRIM(THISFORM.txtFirstName.VALUE)
REPLACE MiddleName WITH ALLTRIM(THISFORM.txtMiddleName.VALUE)

Do Case Code

When you have a multiple case which you would want a different action, you can use the Do Case. Do case is very useful code when used wisely.

DO CASE
CASE THISFORM.txtSqlId.VALUE = 1
MESSAGEBOX("Argentina", "Information")
CASE THISFORM.txtSqlId.VALUE = 2
MESSAGEBOX("Bangladesh", "Information")
CASE THISFORM.txtSqlId.VALUE = 3
MESSAGEBOX("Malaysia", "Information")
CASE THISFORM.txtSqlId.VALUE = 4
MESSAGEBOX("Philippines", "Information")
CASE THISFORM.txtSqlId.VALUE = 5
MESSAGEBOX("Taiwan", "Information")
CASE THISFORM.txtSqlId.VALUE = 6
ENDCASE