FindByKey(UserComponentKey: Integer): IValidationUserComponent;
UserComponentKey. The key of searched user component.
The FindByKey method finds user component in the collection by its key.
If the user component with specified key is not found, FindByKey returns Null.
Executing the example requires the UserComponents object of the IValidationUserComponents type.
Sub UserProc;
Var
UserComponents: IValidationUserComponents;
Del: Boolean;
Component: IValidationUserComponent;
Begin
Del := UserComponents.Remove(0);
If Del Then
Debug.WriteLine("First user component is successfully removed");
Else
Debug.WriteLine("Cannot remove first user component");
End If;
Component := UserComponents.FindByKey(1);
If Component = Null Then
Debug.WriteLine("User component with the 1 key is not found");
Else
Del := UserComponents.RemoveByKey(1);
If Del Then
Debug.WriteLine("User component with the 1 key is successfully removed");
Else
Debug.WriteLine("Cannot remove user component with the 1 key");
End If;
End If;
End Sub UserProc;
After executing the example the first user component and component with the 1 key are removed from the collection. The removal result is displayed in the console window.
See also: