Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- ClipOn 3.0 Reference - c_vpublic() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 C_VPUBLIC()

 DESCRIPTION

 C_VPUBLIC() declares public memory variables for each field in the
 currently selected database.  The memory variables can be used for
 data entry screens and other manipulation where it is not desirable
 to operate directly on the database.  The public variables can have
 the same name as the database fields or can have a specified prefix
 to help identify them as a group.

 SYNTAX

 C_VPUBLIC([prefix])

 PARAMETERS

 prefix (C) is the optional prefix string for the public memory
 variables.  The prefix will be added to the beginning of the
 database field name and will truncate any characters beyond ten
 (10), at the end of the name, to create the public memory variable.
 The prefix string must contain valid characters for Clipper memory
 variables.  If prefix is not specified, the default of no prefix
 (memory variable names are the same as field names) is used.

 RETURNS

 C_VPUBLIC() returns true (.T.) if all memory variables are
 successfully created, or false (.F.) if an error occurs.

 EXAMPLES

 && (Test.dbf has fields: name, addr, city, state, amount)
 use test             && Use test.dbf and add new records in a loop

 c_vpublic("M_")      && Create memory variables with "M_" prefix

 do while .t.
   c_vinit("M_")      && Initialize memory variables to empty values
   @ 1,1 say "Enter Name:    " get m_name
   @ 2,1 say "Enter Address: " get m_addr     && Get data from user
   @ 3,1 say "Enter City:    " get m_city
   @ 4,1 say "Enter State:   " get m_state
   @ 5,1 say "Enter Amount:  " get m_amount picture "99,999.99"
   read
   if lastkey() = 27
     exit
   endif
   append blank        && Add new record
   c_vreplace("M_")    && Replace memory variables into database
 enddo
 c_vrelease("M_")      && Release public memory variables


See Also: C_VINIT() C_VSTORE() C_VREPLACE() C_VRELEASE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson