Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find which record shows first in a grid
Message
From
11/10/2012 03:26:51
Walter Meester
HoogkarspelNetherlands
 
 
To
10/10/2012 12:31:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01554683
Message ID:
01554764
Views:
53
Try this:
PUBLIC oform1

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


DEFINE CLASS form1 AS form
	DataSession = 2
	Top = 0
	Left = 0
	Height = 269
	Width = 351
	DoCreate = .T.
	Caption = "Get firstrow"
	firstrownumber = .F.
	Name = "Form1"

	ADD OBJECT grid AS grid WITH ;
		ColumnCount = -1, ;
		Height = 228, ;
		Left = 0, ;
		RecordSource = "Grid", ;
		Top = 0, ;
		Width = 348, ;
		Name = "Grid"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 235, ;
		Left = 2, ;
		Height = 27, ;
		Width = 108, ;
		Caption = "Get TopRow", ;
		Name = "Command1"

	PROCEDURE getrownumber
		IF ISNULL(THISFORM.Firstrownumber)
			THIS.FirstRowNumber = RECNO()
		ENDIF
	ENDPROC

	PROCEDURE grid.Init
		USE (HOME()+"\samples\northwind\customers.dbf")
		THIS.RecordSourceType= 1
		THIS.RecordSource = "Customers"
		THIS.Column1.DynamicFontBold = "!THISFORM.Getrownumber()"
	ENDPROC

	PROCEDURE command1.Click
		THISFORM.FirstRownumber = NULL
		THISFORM.Grid.Refresh()
		WAIT WINDOW THISFORM.FirstRowNumber
	ENDPROC
ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform