Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection Item data binding
Message
 
To
18/05/2005 05:24:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01014332
Message ID:
01015243
Views:
24
>Hi,
>Sorry, it should be in VFP9.

Here a Sample, not perfect but works :o))
PUBLIC obaseform1

obaseform1=NEWOBJECT("BaseForm1")
obaseform1.Show
RETURN


DEFINE CLASS baseform1 AS Form


	Top = 0
	Left = 0
	Height = 343
	Width = 342
	DoCreate = .T.
	Name = "Baseform1"


	ADD OBJECT list1 AS listbox WITH ;
		Height = 328, ;
		Left = 5, ;
		Top = 13, ;
		Width = 188, ;
		Name = "List1"


	ADD OBJECT text1 AS textbox WITH ;
		ControlSource = "", ;
		Height = 23, ;
		Left = 198, ;
		Top = 16, ;
		Width = 141, ;
		Name = "Text1"


	PROCEDURE Init
		thisform.AddObject("testCollection","Collection")
		WITH thisform.testCollection
		    FOR i = 1 TO 15
		        .Add(REPLICATE(CHR(65+i),5),"Key"+TRANSFORM(i))
		    NEXT
		ENDWITH
		thisform.List1.RowSourceType= 10
		thisform.List1.RowSource = "thisform.testCollection"
        thisform.List1.ListIndex = 1
        thisform.ChangeControls(1)
	ENDPROC


	PROCEDURE list1.InteractiveChange
        thisform.ChangeControls(this.ListIndex)
	ENDPROC


	PROCEDURE text1.LostFocus
		IF this.Tag # this.Value
		   thisform.testCollection.Remove(thisform.List1.ListIndex)
		   thisform.testCollection.Add(this.Value,"Key"+TRANSFORM(thisform.List1.ListIndex),thisform.List1.ListIndex)
		   thisform.List1.Requery()
		ENDIF
	ENDPROC
    
    PROCEDURE ChangeControls(iIndex)
        thisform.text1.Value = thisform.testCollection.Item(iIndex)
    ENDPROC

	PROCEDURE text1.GotFocus
		this.Tag = this.Value
	ENDPROC


ENDDEFINE
*
*-- EndDefine: baseform1
**************************************************
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