Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BIG problem with the grid when refreshing the data! 3

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
Hello,

I've got a BIG problem with my grid. When refreshing the grid, all my functionality I've build within the grid disappears!

What I do to refresh:
I select some records from a table into a cursor (select * from customers where id > 100 into cursor myCustomer).

This.recordsource = 'myCustomer'

Then I make a colored row:
.SetAll("DynamicBackColor","IIF(RECNO(myCustomer)==THIS.nRecordNr, RGB(0,0,128), RGB(255,255,255))", "Column")
.SetAll("DynamicForeColor","IIF(RECNO(myCustomer)==THIS.nRecordNr, RGB(255,255,255), RGB(0,0,0))", "Column")
.Refresh()

Problem:
When the data in the cursor is refreshed, vfp automatically unbinds the cursor to the recordsource of the grid, and then boun it to the recordsource of the grid again. When it unBounds the data, all objects are destroyed, like the columns, textboxes and the headers in the grid. When it bounds the data again, it creates new columns, textboxes and headers. But the problem is that I've got some code in the onClick events from the textboxes in the grid. And because there are new textboxes created all code is gone, and I don't know how to recreate the code in the textboxes onClick events on runtime?


Please help me, I've got no idea how to fix it,
When you could tell the grid that it should create textboxes from myTextboxClass then I could put the code there and everything was alright, but so far as I can see that's not possible.

Thanks for your time,

Charl
 
There are some threads in this forum that handled this question before.

When you refresh your cursor, set the recordsource to "" and then back to your cursor name.

The cursor it was bound to is not the same as the new cursor just created (allthoug the name is the same), therefore the grid resets.

HTH,

Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
THANKS,

I had not seen that there was a FAQ's been written about this subject.

Thought about almost everything, but not on this ''
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top