הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
If you frequently access an object that requires a qualification path of several methods and properties, you can speed up your code by not repeating the qualification path.
There are two ways you can avoid repeating the qualification path. You can assign the object to a variable, or you can use it in a With...End With block.
To speed up access to a heavily qualified object by assigning it to a variable
Declare a variable of the type of the object that you are accessing frequently. Specify the qualification path in the initialization part of the declaration.
Dim ctrlActv As Control = someForm.ActiveForm.ActiveControlUse the variable to access the object's members.
ctrlActv.Text = "Test" ctrlActv.Location = New Point(100, 100) ctrlActv.Show()
To speed up access to a heavily qualified object by using a With...End With block
Put the qualification path in a
Withstatement.With someForm.ActiveForm.ActiveControlAccess the object's members inside the
Withblock, before theEnd Withstatement..Text = "Test" .Location = New Point(100, 100) .Show() End With