Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for existence of a control
Message
From
18/09/2002 17:18:11
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00701952
Message ID:
00702035
Views:
18
>It escapes me the syntax for checking for the existence of a control like a commandbutton. If...............?
>
>-TB


you already have other replies, but another way is
FUNCTION Form_Has_This_Control
  PARAMETER PARAM_Form_Ref , PARAM_Control_Name

  LOCAL int_Control_Count
  LOCAL int_Control_Index
  LOCAL str_Control_Name
  LOCAL boo_Value_To_Return

  boo_Value_To_Return = .F.
  int_Control_Count = PARAM_Form_Ref.CONTROLCOUNT

  FOR int_Control_Index = 1 TO int_Control_Count
    str_Control_Name = PARAM_Form_Ref.CONTROLS(int_Control_Count).NAME
    IF ( str_Control_Name = PARAM_Control_Name )
      boo_Value_To_Return = .T.
    ENDIF
  ENDFOR

  RETURN ( boo_Value_To_Return )
ENDFUNC
may want to do ALLTRIM(UPPER(X)) on both items in IF stmt.
patrick
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform