Many friends often ask how to determine if the object is existed in the PB according to a string of the specified name? For example: Object, Menu, etc. in Window, Control, DataWindow, discuss these situations in this article:
First, how to determine if a designated WINDOW exists?
Classdefinition CD_WINDEFCD_WINDEF = FindClassDefinition ("w_xxx") if isvalid (cd_windef) THEN
//exist
END IF
Second, how to determine if a specified control or specifying the specified property of the specified control in Window exists?
You can use the Control [] array.
Third, how to determine if a specified menu exists?
You can use the Item [] array.
Fourth, how to determine whether the object (eg: specified column) is existed in DataWindow?
(1) Use MessageBox ("1", dw_1.describe ("ObjectName.name")), the described object return value is returned if it is an invalid object! If it is invalid attribute, return? Otherwise returns the correct string. (2) Judging whether the specified object NAME is existing in dw_1.objects in dw_1.objects.
5. How to determine if a specified DataWindow Object exists?
DataStore LD_DS
LD_DS = CREATE DATASTORE
ld_ds.dataObject = "demo"
IF ld_ds.describe ("DataWindow.Objects") = "" "" "" "" can also be used. Syntax // does not exist End IF
Destroy LD_DS
You can also refer to:
Http://search.9cbs.net/expert/topic/1986/1986478.xml?temp=.1623957
http://community.9cbs.net/expert/topic/4038/4038005.xml?temp=.4138758
6. How do I determine if a specified table exists in the database?
You can find it with a database of system tables.