There are times when you may need to modify the enumerated values offered in a combo box. To do this during form initialization, start by creating a display item override. Create a class and name it identically to your display item. Place this class in the SPF.Client. Forms.FormControls namespace and inherit from DisplayItemElement. Add the standard constructor used by the client:
Public Sub New(ByVal pobjSectDisplayItemObj As StructuredObject, _
ByVal pobjSectionContainer As SectionElement, _
ByVal pobjFormDisplayControl As FormDisplayControl)
MyBase.New(pobjSectDisplayItemObj, pobjSectionContainer, pobjFormDisplayControl)
End Sub
To modify the combo box choices as they are being initialized, override this method (OnModifyComboItems).
Public Overridable Sub OnModifyComboItems(ByVal pobjItems As IObjectDictionary)
An example of removing a choice during this method call is as follows.
Dim lobjToBeRemoved As IObject = Nothing
With pobjItems.GetEnumerator
Do While .MoveNext
If .Value.Name.ToUpper = "ISSUED" Then
lobjToBeRemoved = .Value
Exit Do
End If
Loop
End With
If lobjToBeRemoved IsNot Nothing Then
pobjItems.Remove(lobjToBeRemoved)
End If
This example can be found in the training assembly.