Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Spread ActiveX control
Message
 
 
To
22/03/2005 23:16:55
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
SAMBA Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00997132
Message ID:
00998807
Views:
17
Managed to dig out my old VB code last night - I used v2.5 of the spread control (it was 7 years old!)

However, downloaded the evaluation version of 7 this morning, and knocked up this code:
Note that when prompted with Insert Object dialogue, insert the farpoint Spread Control
They all appear to be OLEDB controls, so you could connect that way, but I have manually added data by setting the row,column, and text properties

When the form displays, choose the load button and select a table



Local loForm

loForm = Createobject("frmSpreadTest")
loForm.Show(1)

Return
Endproc




**************************************************
*-- Class: frmspreadtest (d:\spreadtest.vcx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 03/24/05 12:48:07 PM
*
Define Class frmSpreadTest As Form

Top = 4
Left = 4
DoCreate = .T.
Caption = "Spread Test"
Name = "Form1"

Add Object farSpread As OleControl With ;
Top = 4, ;
Left = 4, ;
Height = 210, ;
Width = 363, ;
Anchor = 15, ;
Name = "farSpread"


Add Object cmdload As CommandButton With ;
Top = 222, ;
Left = 5, ;
Height = 23, ;
Width = 70, ;
Anchor = 6, ;
Caption = "Load", ;
Name = "cmdLoad"


Add Object cmdclose As CommandButton With ;
Top = 222, ;
Left = 296, ;
Height = 23, ;
Width = 70, ;
Anchor = 12, ;
Cancel = .T., ;
Caption = "Close", ;
Name = "cmdClose"


Procedure loadspread
Local llContinue, lcTable
Local lnRecords, lnColumns, i, j

llContinue = .T.
lcTable = Getfile("DBF")


If Empty(lcTable)
llContinue = .F.
Else
If lcTable == Dbf()
* skip
llContinue = .F.
Else
Use (lcTable) Shared Noupdate
Endif
Endif

If llContinue And Not Used()
llContinue = .F.
Endif
If llContinue
lnRecords = Reccount()
lnColumns = Fcount()

Thisform.farspread.MaxCols = lnColumns
Thisform.farspread.MaxRows = lnRecords

Thisform.farspread.Row = 0
For j = 1 To lnColumns
Thisform.farSpread.Col = j
Thisform.farSpread.Text = Transform(Fields(j),"")
Endfor

For i = 1 To lnRecords
Go i
Thisform.farSpread.Row = i
For j = 1 To lnColumns
Thisform.farSpread.Col = j

Thisform.farSpread.Text = Transform(Evaluate(Fields(j)),"")

Endfor
Endfor
Endif
Endproc


Procedure Unload
Use
DoDefault()
Endproc


Procedure cmdload.Click
Thisform.loadspread()
Endproc


Procedure cmdclose.Click
Thisform.Release()
Endproc


Enddefine
*
*-- EndDefine: frmspreadtest
**************************************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform