
Of course the method could do much more than simply return the value. The method is defined in the class that defines the property and so it can see the property, and return its value to the caller even though the caller cannot actually see the property. However, when we call the GetProperty() method – which is itself public remember - there is no problem. Rather than my giving you step by step instructions for that part, see this paper on my website:įor this particular task, you need the "Working with Categories" and "Working with Items" sections.As you can see, by declaring the property protected we get an “Property does not exist” error when we try to access it directly from outside. My personal favorite is to use the Toolbox. There are a number of different ways to use custom classes in VFP.
#VFP DEFINE CLASS CODE#
Cut and paste the code from the program into the relevant properties of your class. For Store in, give the name of a class library where you want to put this class.ģ) For each of the properties shown between the Define Class and the next *-, find the relevant item in the Property Sheet and set it as shown in the code.Ĥ) Add the custom sourcefield property by choosing Class | New Property from the menu.ĥ) It looks like the only methods there that include code are Init, Valid and Refresh. (If you already have a set of your own "base" classes, then choose your "base" Textbox class instead. SET DATE SHORT lcDate=DTOC(ldGregoDate) lcDate=SUBSTR(lcDate,7,4)+SUBSTR(lcDate,6,1) + SUBSTR(lcDate,4,2) + SUBSTR(lcDate,3,1) Īssuming you really have a textfile like the one you showed and not a VCX, the first thing you need to do is convert that code to a visual class in a VCX.ġ) From the Command Window, type CREATE CLASS.


LcTable=SUBSTR(lcField,1,AT(".",lcField)-1) lcTable="'"+lcTable+"'"ĮLSE MESSAGEBOX("Record can not lock! Replacement is ignored",0) MESSAGEBOX("Please check the day! Use 29 instead of 30",48, "Day OR VAL(SUBSTR(lcEqualHijDate,7,4)) < lnHijyr Month lnGreDay=VAL(SUBSTR(DTOC(ldGreDate),1,2)) & Current Gregorian day IF lnHijDay 30 & Verifies for maximum day number 30 MESSAGEBOX("Wrong Hijri Day entered ",48,"Wrong Hijri Day")ĮNDIF lnGreYr=VAL(SUBSTR(DTOC(ldGreDate),7,4)) & Current Gregorian year lnGreMon=VAL(SUBSTR(DTOC(ldGreDate),4,2)) & Current Gregorian IF lnHijYr>1550 or lnHijYr 12 & verifies for correct month number MESSAGEBOX("Wrong Hijri Month entered",48,"Wrong Hijri Month")ĮNDIF lnHijDay=VAL(SUBSTR(lcHijDateInput,9,2)) * & Verifies for up to 125 year in future or 100 years in past LcHijDate=lcHijDay+SUBSTR(lcHijDateinput,8,1)+lcHijMon+ SUBSTR(lcHijDateinput,5,1)+lcHijYr lnHijYr=VAL(SUBSTR(lcHijDateInput,1,4)) OR !INLIST(SUBSTR(lcHijDateInput,5,1),'/','-','.') MESSAGEBOX("Your System Calendar is not Hijri Calendar Or Invalid", "Hijri DateĮntered! It should be 10 digits like 0",, 48, "Invalid Hijri Date" )ĮNDIF lcHijYr=SUBSTR(lcHijDateInput,1,4) lcHijMon=SUBSTR(lcHijDateInput,6,2) lcHijDay=SUBSTR(lcHijDateInput,9,2) ** The following line will check the separator in input date SET DATE SHORT lcEqualHijDate=SPACE(10) & Will be use like CTOD() The system date Calendar should be set to Hijri Calendar LOCAL lnGreDay,lnGreMon, lnGreYr, lcHijDateInput=this.Value LOCAL lcGreDay,lcGreMon, lcGreYr, ldGreDate LOCAL lnHijDay,lnHijMon, lnHijYr LOCAL lcHijDay,lcHijMon, lcHijYr, lcHijDate, lcTable LdConvDate,lcOpr,lcEqualHijDate, lcHijDateInput, lcField, lnDtCounter MESSAGEBOX('SourceField not specified! Specify the field name in ', 'SourceFiled property') PROCEDURE Init this.ControlSource="None" & To avoid conflict due to *- This class is designed to store the Hijri Dates in standard *- Class:hijritogrego (c:\program files\hijri dates\localdate.vcx)
#VFP DEFINE CLASS HOW TO#
Have not used classes before and I don't know how to get benift from this class. so How do I implement this class in my program.

the class "To conver the Hijri date to Gregorain date".

I ger it form the artical which you directed me to.
