Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate input into grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01017586
Message ID:
01017603
Views:
16
Try this. It is not a very good looking but will gives you direction (I hope :o))
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   05/25/05 09:01:01 PM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	currentrec = .F.


	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 2, ;
		Height = 200, ;
		Left = 24, ;
		Panel = 1, ;
		Top = 42, ;
		Width = 320, ;
		Name = "Grid1", ;
		Column1.Width = 126, ;
		Column1.Name = "Column1", ;
		Column2.Width = 144, ;
		Column2.Name = "Column2"


	ADD OBJECT form1.grid1.column1.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"


	ADD OBJECT form1.grid1.column1.text1 AS textbox WITH ;
		BorderStyle = 0, ;
		Margin = 0, ;
		ForeColor = RGB(0,0,0), ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


	ADD OBJECT form1.grid1.column2.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"


	ADD OBJECT form1.grid1.column2.text1 AS textbox WITH ;
		BorderStyle = 0, ;
		Margin = 0, ;
		ForeColor = RGB(0,0,0), ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 13, ;
		Left = 36, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Add", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 13, ;
		Left = 121, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Save", ;
		Name = "Command2"


	PROCEDURE Load
		CREATE CURSOR Test (Field1 C(10), Field2 N(5))
		SET MULTILOCKS ON
		CURSORSETPROP("Buffering",5, "test")
	ENDPROC


	PROCEDURE command1.Click
		this.Enabled = .f.
		APPEND BLANK IN Test
		thisform.currentrec = RECNO("Test")
		thisform.Grid1.Refresh()
	ENDPROC


	PROCEDURE command2.Click
		GOTO thisform.currentrec IN Test
		thisform.Grid1.Refresh()
		IF EMPTY(Test.Field1) OR EMPTY(test.Field2)
		   MESSAGEBOX("Something Wrong")
		   RETURN
		ENDIF
		TABLEUPDATE(1,.t.,"Test")
		thisform.Command1.Enabled = .t.
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform