If you make a hidden textbox (outside the screen with visible set to true), then use something like this, you can kinda make it work. I guess you'll need to add a timer to remove the text in the textbox after a second or so to make it function a bit better.
Code:public Form1() { InitializeComponent(); listBox1.MouseUp += new MouseEventHandler(listBox1_MouseUp); textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress); } void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Back) { textBox1.Text = ""; } } void listBox1_MouseUp(object sender, MouseEventArgs e) { textBox1.Focus(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text != "") { listBox1.SelectedIndex = listBox1.FindString(textBox1.Text); } }
Edit: Updated code slightly




Reply With Quote