Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many rows are there in grid?
Message
From
08/02/2008 04:20:02
 
 
To
07/02/2008 12:57:44
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01290490
Message ID:
01290749
Views:
23
>Is there any way to see total number of non-empty rows in a grid?

You can start with this raw code:
PUBLIC oform1

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

DEFINE CLASS form1 AS form

	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 3, ;
		Anchor = 5, ;
		Height = 200, ;
		Left = 27, ;
		Top = 42, ;
		Width = 320

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 8, ;
		Left = 220, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "click here"

	PROCEDURE call
		DEBUGOUT SECONDS(),RECNO()
	ENDPROC


	PROCEDURE Load
		CREATE CURSOR TEST (A I,B I,C I)
		FOR K=1 TO 300
			APPEND BLANK
		NEXT
	ENDPROC


	PROCEDURE command1.Click
               * optimize and put this code into the grid class
		WITH THISFORM.GRid1.Columns[1]
			PRIVATE rowsData
			rowsData = 0
			thisform.LockScreen = .T.
			.DynamicFontShadow = '_VFP.SetVar("rowsData",m.rowsData+1)'
			THISFORM.GRid1.Refresh
			.DynamicFontShadow = ''
			thisform.LockScreen = .F.
		ENDWITH
		this.Caption = TRANSFORM(m.rowsData)

	ENDPROC

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform