When must I set a variable to “Nothing” in VB6?

后端 未结 8 3542
刺人心
刺人心 2021-02-20 19:00

In one of my VB6 forms, I create several other Form objects and store them in member variables.

Private m_frm1 as MyForm
Private m_frm2 as MyForm

// Later...
Se         


        
8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-20 19:27

    @Martin

    VB6 had a "With/End With" statement that worked "like" the Using() statement in C#.NET. And of course, the less global things you have, the better for you.

    With/End With does not working like the Using statement, it doesn't "Dispose" at the end of the statement.

    With/End With works in VB 6 just like it does in VB.Net, it is basically a way to shortcut object properties/methods call. e.g.

    With aCustomer
      .FirstName = "John"
      .LastName = "Smith"
    End With
    

提交回复
热议问题