We help IT Professionals succeed at work.

vfp how to add check box dynamically to a form

LimMH
LimMH asked
on
Hi,

How do I add check box dynmically to a form?
Can it be done from the form init?

Thanks
Comment
Watch Question

Commented:
Found:

            cChkName = "chk"+TRANSFORM(AVc,"@L ##")
            this.AddObject(cChkName,"CheckBox")
            WITH thisform.&cChkName
            .Top = (AVc-1) * 20 + 40
            .Left = 20
            .AutoSize = .T.
            .Caption = alltrim(arra3b[AVc,1])
            .Visible = .t.
            ENDWITH
Yes, when you insert following code to Form's Init event then Checkbox appears:

THISFORM.AddObject("CheckBoxObjectName","Checkbox")

WITH THISFORM.CheckBoxObjectName
  .Visible = .T.
  .Caption = "MyNewCheckbox"
  .Top = 20
  .Left = 30
  .Value = 1
  * etc.
ENDWITH
You are too fast... :-)