CREATE CURSOR Z1 (Field1 C(10),FIeLD2 C(10),FIELD3 C(10))
loForm=CREATEOBJECT("form")
loform.show
loform.caption="Example"
loform.height=450
loform.visible=.t.
loForm.Addobject('txtBox1','TextBox')
loForm.Addobject('txtBox2','TextBox')
loForm.Addobject('txtBox3','TextBox')
loForm.txtBox1.Left=50
loForm.txtBox1.Width=100
loForm.txtBox1.top=10
loForm.txtBox2.Left=160
loForm.txtBox2.Width=100
loForm.txtBox2.top=10
loForm.txtBox3.Left=270
loForm.txtBox3.Width=100
loForm.txtBox3.top=10
loForm.txtBox1.Visible=.t.
loForm.txtBox2.Visible=.t.
loForm.txtBox3.Visible=.t.
loForm.Addobject('grdZ1','Grid')
loForm.grdZ1.RecordSourceType=1
loForm.grdZ1.RecordSource='Z1'
loForm.grdZ1.Left=50
loForm.grdZ1.top=50
loForm.grdZ1.Visible=.t.
loForm.Addobject('cmdCmndBtn','cmdMyCmndBtn')
loForm.cmdCmndBtn.Visible=.t.
loForm.Addobject('cmdExit','cmdMyExit')
loForm.cmdExit.Visible=.t.
READ events
DEFINE CLASS cmdMyExit AS CommandButton && Create Command button
Caption = 'Exit' && Caption on the Command button
Cancel = .T. && Default Cancel Command button (Esc)
Left = 170 && Command button column
Top = 300 && Command button row
Height = 25 && Command button height
PROCEDURE Click
CLEAR EVENTS && Stop event processing, close Form
ENDDEFINE
DEFINE CLASS cmdMyCmndBtn AS COMMANDBUTTON && Create Command button
Caption = 'Add new record' && Caption on the Command button
Left = 50 && Command button column
Top = 300 && Command button row
Height = 25 && Command button height
PROCEDURE Click
SELECT Z1
APPEND BLANK
replace Field1 WITH This.parent.txtBox1.value,;
Field2 WITH This.parent.txtBox2.value,;
Field3 WITH This.parent.txtBox3.value
This.parent.grdZ1.Refresh()
This.parent.txtBox1.value=SPACE(10)
This.parent.txtBox2.value=SPACE(10)
This.parent.txtBox3.value=SPACE(10)
ENDDEFINE
<\PRE>