From ceddf3d4ef7c3e5c59086579e2a33abdfabebd46 Mon Sep 17 00:00:00 2001 From: emoose Date: Mon, 19 Jan 2026 01:25:31 +0000 Subject: [PATCH] Only search by exe name if entered profile name doesn't exist This was meant to be happening automatically, but seems WinForms also decides to send a KeyUp event with e.KeyCode == Keys.Enter when the user clicks an existing item (?) --- nspector/frmDrvSettings.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/nspector/frmDrvSettings.cs b/nspector/frmDrvSettings.cs index f183d0e..e6181e5 100644 --- a/nspector/frmDrvSettings.cs +++ b/nspector/frmDrvSettings.cs @@ -766,18 +766,20 @@ namespace nspector if (e.KeyCode == Keys.Enter) { - // KeyUp event is only fired when combobox item doesn't exist with the entered text - // Try searching for text as an exe/application name - try + // Search by exe name if the text isn't already a valid profile name + if (!_profileNames.Contains(cbProfiles.Text)) { - var profile = _drs.GetProfileNameByExeName(cbProfiles.Text); - if (!string.IsNullOrEmpty(profile)) + try { - cbProfiles.Text = profile; - ChangeCurrentProfile(profile); + var profile = _drs.GetProfileNameByExeName(cbProfiles.Text); + if (!string.IsNullOrEmpty(profile)) + { + cbProfiles.Text = profile; + ChangeCurrentProfile(profile); + } } + catch { } } - catch { } } }