# winforms-lookup-display-custom-text-for-not-found-edit-value
**Repository Path**: yangbobin/winforms-lookup-display-custom-text-for-not-found-edit-value
## Basic Information
- **Project Name**: winforms-lookup-display-custom-text-for-not-found-edit-value
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: 13.1.4+
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-05-06
- **Last Updated**: 2025-05-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README

[](https://supportcenter.devexpress.com/ticket/details/E781)
[](https://docs.devexpress.com/GeneralInformation/403183)
[](#does-this-example-address-your-development-requirementsobjectives)
# WinForms Lookup - Display custom text if the lookup's value is not found in the drop-down list
This example handles the [Properties.CustomDisplayText](https://docs.devexpress.com/WindowsForms/DevExpress.XtraEditors.Repository.RepositoryItem.CustomDisplayText) event to display custom text if the lookup's `EditValue` does not match any value in the drop-down list (the value does not exist in the data source).
```csharp
const string NotFoundText = "???";
private void RepositoryItemLookUpEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e) {
RepositoryItemLookUpEdit props;
if(sender is LookUpEdit)
props = (sender as LookUpEdit).Properties;
else
props = sender as RepositoryItemLookUpEdit;
if(props != null && (e.Value is int)) {
object row = props.GetDataSourceRowByKeyValue(e.Value);
if(row == null) {
e.DisplayText = NotFoundText;
}
}
}
```
## Files to Review
* [Form1.cs](./CS/Form1.cs) (VB: [Form1.vb](./VB/Form1.vb))
## Documentation
* [Lookup Editors](https://docs.devexpress.com/WindowsForms/116008/controls-and-libraries/editors-and-simple-controls/lookup-editors)
* [Lookup Main Settings](https://docs.devexpress.com/WindowsForms/116029/controls-and-libraries/editors-and-simple-controls/lookup-editors/lookup-editors-and-main-settings)
* [Standard Binding (to Simple Data Types)](https://docs.devexpress.com/WindowsForms/116015/controls-and-libraries/editors-and-simple-controls/lookup-editors/standard-binding-to-simple-data-types)
## See Also
* [DevExpress WinForms Troubleshooting - LookUp Editors](https://go.devexpress.com/CheatSheets_WinForms_Examples_T929986.aspx)
* [How to Determine if a Value Put into the LookupEdit Does Not Exist in the Data Source](https://supportcenter.devexpress.com/ticket/details/a149/how-to-determine-if-a-value-put-into-the-lookupedit-does-not-exist-in-the-lookup-data)
* [How to Use the ProcessNewValue Event of a LookUp Editor](https://supportcenter.devexpress.com/ticket/details/a238/how-to-use-the-processnewvalue-event-of-a-lookup-editor)
## Does this example address your development requirements/objectives?
[
](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-lookup-display-custom-text-for-not-found-edit-value&~~~was_helpful=yes) [
](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-lookup-display-custom-text-for-not-found-edit-value&~~~was_helpful=no)
(you will be redirected to DevExpress.com to submit your response)