Is there a need to set Objects to Nothing inside V

2019-01-02 21:01发布

I always read that it is recommended to set objects to nothing, once I am done with them. But I normally use them only in functions inside forms.

Isn't the reference lost and memory released when the function scope is left, regardless of setting objects to Nothing?

i.e. is it really necessary to do:

Set db = Nothing
Set record_set = Nothing

7条回答
旧时光的记忆
2楼-- · 2019-01-02 21:38

Try this

If Not IsEmpty(vMyVariant) Then
    Erase vMyVariant
    vMyVariant = Empty
End If
查看更多
登录 后发表回答