# Handling SelectionChanged event for DataFormComboBoxField

DataFormComboBoxField does not have a SelectionChanged event itself. In case you need such an event to implement your additional logic, you can handle the SelectionChanged event of its editing element (RadComboBox). To do that you need to:

1. Register an event handler for the SelectionChanged event:

**Example 1: Adding event handler for the SelectionChanged event**

```C#
this.AddHandler(RadComboBox.SelectionChangedEvent, new System.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged));
```

```VB.NET
Me.[AddHandler](RadComboBox.SelectionChangedEvent, New Telerik.Windows.Controls.SelectionChangedEventHandler(onSelectionChanged), True)
```

> You should add a using statement to **Telerik.Windows** namespace in order to be able to add the handler.

2. Check if any items were unselected throught **RemovedItems.Count**

**Example 2: Check if any items were unselected**

```C#
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (e.RemovedItems.Count > 0)
    {
        //your code here
    }
}
```

```VB.NET

Private Sub onSelectionChanged(sender As Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs)
           If e.RemovedItems.Count > 0 Then
           End If
       End Sub
```

Checking if there are any items being unselected through the RemovedItems.Count ensures that the event will not be handled on the initial loading when a default item has been selected.

## See Also

* [Edit Lookup Values with RadComboBox](https://www.telerik.com/products/wpf/documentation/controls/raddataform/how-to/raddatafor-edit-lookup-values-with-radcombobox)
