I'm using a component called QTextBox
from Qios DevSuite in my project.
Similar to what happens by default in .NET TextBox
, when user presses Control+Backspace on it while typing, instead of deleting the word left from the cursor, character '' is inserted instead.
To resolve this issue, I figured I'd do something like
public class QTextBoxEx : QTextBox
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.Back))
{
// here goes my word removal code
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
Is this a good approach or is there already a .NET built in system to implement this kind of behavior? Also, what would be the "cleanest" way of removing the last word from a search string? (I can think of string.Replace and Regex right now)