Search This Blog

Cancel Close Code



If you want your button's picture to change when your Close/Cancel button also changed.

IF THIS.Picture = "c:\SalesMarket\Images\close.jpg"
THISFORM.Release()
ELSE
THIS.Picture = "c:\SalesMarket\Images\close.jpg"
THISFORM.ReadOnlyTrue()
THISFORM.Combo1.Enabled = .F.
THISFORM.cmdPrint.Enabled = .T.
THISFORM.cmdEdit.Enabled = .T.
THISFORM.cmdEdit.Picture = "c:\SalesMarket\Images\edit.jpg"
ENDIF

Local View and Remote View

Samples of Local View and Remote View with different filter using like, between and =.

SELECT SviewAccountChart
lAccountCode = ALLTRIM(THISFORM.Text16.Value)+"%"
=REQUERY("SviewAccountChart")

SELECT SviewJvHeader
lJvNo = ALLTRIM(THISFORM.Text20.Value)+"%"
lJvBranch = ALLTRIM(THISFORM.Text21.Value)+"%"
=REQUERY("SviewJvHeader")

SELECT SviewCheckIssueReg
lCheckNum = ALLTRIM(THISFORM.Text20.Value)+"%"
lCheckType = ALLTRIM(THISFORM.Combo3.Value)+"%"
StartDate = THISFORM.Text14.Value
EndDate = THISFORM.Text15.Value
=REQUERY("SviewCheckIssueReg")

Opening a PDF File

You can open a PDF file in VFP b using below codes. Just specify the location of your PDF file on cFileName

DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
cFileName = "c:\GenLed\Images\CC.pdf"
cAction = "open"
ShellExecute(0,cAction,cFileName,"","",1)

Close or Exit Code

Sometimes when you tried to exit or close the program but unsuccessfully close. Try below codes. This is due to the READ EVENTS that sre still running so you need to CLEAR EVENTS then QUIT.

CLEAR EVENTS
QUIT

Disable Code

How to disable command button, text box, combo box, grid and pageframe:


Thisform.Command1.Enabled = .F.
Thisform.Text1.Enabled = .F.
Thisform.Combo1.Enabled = .F.
Thisform.Grid1Enabled = .F.
Thisform.Pageframe1.Enabled = .F.

FoxPro Graph

To those who are neophyte in VFP Language might have a hard time researching and building a graph in a form and report. I also had a hard time making a graph when I first encountered a VFP Project with a graph. But once you learned, it is easy for the next project to bulid a graph in form and report.

You need the following requirements before continuing to the graph:
Table
OleGraph
Grid

SELECT * FROM crewquestion INTO CURSOR MYCURSOR
TAB = CHR(09)
CRLF = CHR(13) + CHR(10)
SELECT MYCURSOR
NEWDATA = TAB + "Recruitment & Selection" + TAB + "Documentation" + TAB ;
+ "In House Training" + TAB + "Accounting Activity" + TAB + "Working Gears" + ;
CRLF
SCAN
NEWDATA = NEWDATA + TAB + STR(question1) + TAB + STR(question2) + TAB ;
+ STR(question3) + TAB + STR(question4) + TAB + STR(question5) + ;
CRLF
ENDSCAN
SELECT crewquestion
APPEND GENERAL crewques1.Olegraph DATA NEWDATA
SELECT crewquestion
THISFORM.REFRESH

SELECT * FROM crewquestion INTO CURSOR MYCURSOR
TAB = CHR(09)
CRLF = CHR(13) + CHR(10)
SELECT MYCURSOR
NEWDATA = TAB + "Padala Sytem" + TAB + "Company Facilities" + TAB + "Attitude of Staff" + TAB ;
+ "P&I Medical Assistance" + CRLF
SCAN
NEWDATA = NEWDATA + TAB + STR(question6a) + TAB + STR(question6b) + TAB + STR(question6c) + TAB ;
+ STR(question6d) + CRLF
ENDSCAN
SELECT crewquestion
APPEND GENERAL crewques2.Olegraph DATA NEWDATA
SELECT crewquestion
THISFORM.REFRESH

Back Color

Changing the back color of an Edit Box. Same applies to Text Box, Combo Box or Grid.

THISFORM.TEXT1.BackColor = RGB(255,255,255)
THISFORM.EDIT1.BackColor = RGB(255,255,255)
THISFORM.EDIT2.BackColor = RGB(255,255,255)
THISFORM.EDIT3.BackColor = RGB(255,255,255)
THISFORM.EDIT4.BackColor = RGB(255,255,255)
THISFORM.EDIT5.BackColor = RGB(255,255,255)
THISFORM.EDIT6.BackColor = RGB(255,255,255)
THISFORM.EDIT7.BackColor = RGB(255,255,255)
THISFORM.EDIT8.BackColor = RGB(255,255,255)