zoukankan      html  css  js  c++  java
  • VB操作Excel无法更新的问题研究(续)

    初步找到问题所在,是因为使用了form.hide而不是unload form。也就是隐藏窗体还是关闭窗体,导致了数据更新问题。

    You can hide a form so that it is not visible to a user. When the form is hidden, the user cannot interact with the form, but you still have full programmatic control of them.

    To hide a form

    Use the Hide method.
    For example, in the code associated with the Click event of a command button, you could include the following line of code:

    THISFORM.Hide

    When the user clicks the command button, the form remains in memory, but is not visible.

    Releasing a Form
    You can allow a user to release a form when he or she is finished interacting with it. When you release a form, you can no longer access properties and methods of the form.

    To release a form

    Call the Release method.
    For example, in the code associated with the Click event of a command button, you could include the following line of code:

    THISFORM.Release

    When the user clicks the command button, the form closes.

    Unload Forms

    This will unload all forms in memory before the calling form is unloaded. Not only does this unload each form, it also fires each form's unload event, allowing for a more thorough clean up. Since this is placed in the Query_Unload event, errors can be handled and decisions can be made if the unloading should continue. This is especially useful when using other third-party controls such as the splitter control.

    Place the following code in your main form's Query_Unload event.

     
    Dim f As Form

    For Each f In Forms
        If f.hwnd <> Me.hwnd Then
            Unload f
        End If
    Next

  • 相关阅读:
    log4j输出信息到mongodb
    mongodb日志服务器方案
    mongodb的高级操作(聚合框架)
    mongdb高级操作(group by )
    mongodb的优化
    mongodb集成spring
    mongodb的固定集合(优化效率)
    mongodb的查询操作符
    mongoDB中的连接池(转载)
    mongodb在java驱动包下的操作(转)
  • 原文地址:https://www.cnblogs.com/ainima/p/6331527.html
Copyright © 2011-2022 走看看