Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Grid shows up correctly only the first time
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059678
Message ID:
01059678
Views:
51
Hi everybody,

I put a grid in the container control what I instantiate on the fly on the form. In this grid I set first column to use checkbox, I specified grid's layout, etc.

I left RecordSource for the grid empty and control sources for the columns empty as well.

I have the following code in Init method of the container:
CREATE CURSOR cUsersList (lSelect L, cEmpName C(50), cUserID C(10), cPK C(16))
	INDEX on UPPER(cEmpName) tag cEmpName
	INDEX ON lSelect TAG lSelect
	INSERT INTO cUsersList (cUserID, lSelect, cEmpName, cPK) ;
	SELECT cUserID, .f. as lSelect, cEmpName, cUsgrlink_pk FROM c_AllUsers order by cEmpName
	GO TOP IN cUsersList
	this.grdUsers.RecordSource = 'cUsersList'
	USE IN SELECT('c_AllUsers')
E.g. I try to set RecordSource after the grid is already initialized.

Now, when I first instantiate this container on the form, the grid displayes correctly. But if I remove the container and try to add it again, the nice grid layout and checkboxes are lost.

The question is: why it works the first time and doesn't work the next time during form's life-time? How can I make it to work consistently correctly?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View