PUBLIC oForm oForm = CREATEOBJECT('myForm') oForm.Show define class myForm as Form add object myButton as CommandButton ; with Caption = '\<Add',Height=30,Width=50 Procedure myButton.Click if this.Caption = '\<Add' * code to execute on 'add' MESSAGEBOX("Adding...") this.Caption = '\<Save' else * code to execute on 'save' MESSAGEBOX("Saving...") this.Caption = '\<Add' endif endproc enddefineHowever having a form level (or commandgroup level) property like AddMode,EditMode is better IMHO.