How to refresh form when I open?

别说谁变了你拦得住时间么 提交于 2020-01-16 07:41:22

问题


I have a CheckBox in my TabPage on my Form, if I select the checkBox, the value is saved in a Table field (present in my FormDataSource: ParametersTable).

I want to refresh the form when I enter in TabPage, just Like pressing F5.

Is it possible?


回答1:


There is a great article about different methods of refreshing the form's data here. Here are the basic outline:

1. Refresh

This method basically refreshes the data displayed in the form controls with whatever is stored in the form cache for that particular datasource record. Calling refresh() method will NOT reread the record from the database. So if changes happened to the record in another process, these will not be shown after executing refresh().

2. Reread

Calling reread() will query the database and re-read the current record contents into the datasource form cache. This will not display the changes on the form until a redraw of the grid contents happens (for example, when you navigate away from the row or re-open the form). You should not use it to refresh the form data if you have through code added or removed records.

3. Research

Calling research() will rerun the existing form query against the database, therefore updating the list with new/removed records as well as updating all existing rows. This will honor any existing filters and sorting on the form, that were set by the user.

4. ExecuteQuery

Calling executeQuery() will also rerun the query and update/add/delete the rows in the grid. ExecuteQuery should be used if you have modified the query in your code and need to refresh the form to display the data based on the updated query.

I strongly recommand that you read the article. Try to use some of the methods above or some combinations of them.

Start with research() method, it might solve your problem:

formDataSource.research();


来源:https://stackoverflow.com/questions/29913729/how-to-refresh-form-when-i-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!