Grid and textbox Refresh issue.  
Author Message
Dannible





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

I'm having this problem with an application I’m writing. I have a Grid with a couple of text boxes next to it. When you select a record it updates the values in the textboxes with the values from that record. I also have a few command buttons that switch the tables viewed in the grid.

Now here’s my problem... The text boxes stop updating after I change the tables a few times. Not sure what I am missing because I don't get any error messages and it does work for a little while. If you need more information let me know.




Visual FoxPro1  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

What's the code in AfterRowColChange

What's the controlsource of one of those textbox that stop updating Do they really stop updating or there is nothing to update

After switching tables a few times (how you do that ) is aliases still pointing to correct tables Is record pointers are moving as intended (ie: a broken relation )


 
 
Dannible





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

In the AfterRowColChange I have:

_mainform.refresh

When you click on a command buttons to change tables i have:

_mainform.grid1.recordsource = ("data\dvd.dbf")

_MainForm.CATEGORYID1.ControlSource = ("dvd.CATEGORYID")
_MainForm.subject1.ControlSource = ("dvd.subject")
_MainForm.movietitle1.ControlSource = ("dvd.movietitle")
_MainForm.rating1.ControlSource = ("dvd.rating")
_MainForm.note1.ControlSource = ("dvd.note")

_mainform.refresh

The buttons to change the tables are basically the same code but with different tables. I can see the record selector change when I choose the next record and the text boxes update too.



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

Try changing _mainform to thisform. _MainForm is not guaranteed to be be thisform (public var, scx name both dangerous).


 
 
CetinBasoz





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

If you're changing like this, instead you could bind your textboxes to an alias say myCurrent and use new table with that alias. This way there is no guarantee "dvd" would be pointing to the table you think it should.

When they stop changing check recno('dvd') against recno() of grid recordsource.


 
 
Don Higgins





PostPosted: Visual FoxPro General, Grid and textbox Refresh issue. Top

You need to use a safe select method to change data in a grid on the fly.

See www.tightlinecomputers.com they have a complete listing of what this entails.