The text value of the specified edit control or ID of the selected item when the lookup mode is used. This property is not accessible in the Object Inspector.
object.AsVariant
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISEdit interface |
object
Initialize the edit control by the custom lookup array and LookupStrParams and select in the control the first item of the array by its ID.
Sub Main()
Dim aEdit
Dim aFilter
Dim aProviders, aProvider
Dim aLookupArray
Set aEdit = Form.Controls_("edtInform")
set aFilter = Profile.CreateProvidersFilter
aFilter.Category = 2 'pcProvider
set aProviders = Profile.LoadProvidersByFilter(aFilter)
ReDim aLookupArray(aProviders.Count, 2)
for i = 0 to aProviders.Count - 1
set aProvider = aProviders.Item(i)
aLookupArray(i, 0) = aProvider.Id
aLookupArray(i, 1) = aProvider.FullName
next 'i
aEdit.LookupArray = aLookupArray
aEdit.LookupStrParams = "SortMode=ById"
if aProviders.Count > 0 then
set aProvider = aProviders.Item(0)
aEdit.AsVariant = aProvider.Id
end if
End Sub