JavaScript Editor js editor     Web development 



Main Page

Specifies multiple properties for an object.

WITH ObjectName [AS <Type> [OF <Class Library>]]
   [.cStatements]
ENDWITH

Parameters

ObjectName


Specifies the name of the object. ObjectName can be the name of the object or a reference to the object.
Type


A base class, class name, or type library. (For Intellisense only)
Class Library


Class library containing the base class, class name, or type library specified with Type. (For Intellisense only.)
.cStatements


cStatements can consist of any number of Microsoft Visual FoxPro commands used to specify properties for ObjectName. Place a period before cStatement to denote that it is a property of ObjectName.

Remarks

WITHВ ...В ENDWITH provides a convenient way to specify a number of properties for a single object. Note that you can also execute methods from within a WITHВ ...В ENDWITH structure.

Example

The following example creates a custom class name Employee. After the Employee class has been created with CREATEOBJECT(В ), WITHВ ...В ENDWITH is used to set multiple properties for the class. The properties values are then displayed.

В Copy Code
moemployee = CREATEOBJECT('employee')

WITH moemployee
   .First_Name = 'John'
   .Last_Name = 'Smith'
   .Address = '16 Maple Lane'
   .HireDate = {^1998-02-16}
ENDWITH

CLEAR
? moemployee.First_Name + ' '
?? moemployee.Last_Name
? moemployee.Address
? moemployee.HireDate

DEFINE CLASS employee AS CUSTOM
      First_Name = SPACE(20)
      Last_Name = SPACE(20)
      Address = SPACE(30)
      HireDate = {  -  -  }
ENDDEFINE

See Also



JavaScript Editor js editor     Web development