English 中文(简体)
网格控制刷新
原标题:GridControl Refresh

I have a grid control in vfp9 on a form. And I have a button witch deletes (with pack) the current record. After I delete the record the grid doesn t find the resource. It remains only an empty rectangle. I maked something like this: DELETE ALL PACK GO TOP thisform.grid1.Refresh

但没有效果 提前谢谢

最佳回答

正如塔玛所说,背包在日常活动中非常糟糕。然而,有一个“整装”可以“隐藏”记录,通过所有正常作业记录你,直到晚上处理行政任务,永久删除记录。

SET DELETED ON
SET DELETED OFF

将“ ON” 转换为“ ON ” ( 整个应用程序只需做一次, 除非您处理的是处理私人数据会话的表格, 否则也需要这样做 。 SET Deleted On 告诉 VFP 任何标明要删除的记录, 这样它们就不会在屏幕上遮蔽。 它也会将它们隐藏在任何类型的 SQL 查询中, 这样您就不会被标记为删除 。

以备不时之需,它会把藏起来的藏起来,并允许你再次看到任何/全部删除的记录。 这样, 以防你无意中将记录标记为删除, 并需要“ 收回 ” ( 未删除 ) 。

现在,所有的话都这么说了。如果你标记删除记录,比如在找到标准后设置的过滤器, 进行全部删除, 包装, 那很糟糕...

您只需在按钮点击事件中

DELETE
Thisform.YourGridObject.Refresh()

记录应该从列表中直观地删除。 当您发布 PACK 时, 它实际上会将表格关闭, 从而将自己从网格中卸下, 删除所有删除的记录, 然后通过清理版本重新打开, 但不会自动重新组合到网格中 。

问题回答

问题在于您重新创建了网格记录源, 而它不喜欢这样。 在不知道您正在做什么的情况下, 很难提供具体的建议。 但是, 在正常应用活动中, 包装一张表格通常被认为是坏的。 通常情况下, PACK 被保留在工作时间运行的行政代码中, 因为它需要独家访问该表格 。

你的目标是什么? 为什么你要删除表格里所有 网格所基于的记录?

Tamar 塔马

VFP网格讨厌记录源 被这样修改。

您需要切断您的网格记录源( 即设置为“ ” ), 进行操作, 然后重置记录源并刷新 。





相关问题
Nested record information hiding in Delphi

I have a relatively complicated data structure to model. I would like to do this with a record structure in Delphi, and the structure is complicated enough to justify splitting this into nested ...

Insert multiple records using Linq to Entities (EF)

I have a map table (tblUserRoles) which can contain multiple records. When i insert only one record using L2E it saves but when try to save multiple records it gives exception. I am saving like this: ...

Why can t Delphi records have inheritance?

Something I ve wondered for a long time: why aren t Delphi records able to have inheritance (and thus all other important OOP features)? This would essentially make records the stack-allocated ...

What is the best way to join 2 records in Pascal?

I ve a little problem with records in Pascal. I m writting a program where I ve got two lists of records: one with patients and second with diseases but I don t have idea how to join it. I was trying ...

Records and Generic Containers in Delphi

I m going slightly mad (singing Queen s song) about records with Generic Containers (TList). First, see this code: TItemRec = record private FSender : TAction; FOwnerPack : HModule; ...

Records in Delphi

some questions about records in Delphi: As records are almost like classes, why not use only classes instead of records? In theory, memory is allocated for a record when it is declared by a variable; ...

Preparing a database in access? need help!

I am working in a small law firm and my boss has asked me to put a database together to help with outgoing mail. There are 5 different tables that exist in Access. (Applicants, Attorneys, Lien ...

热门标签