public class DropDownBase : System.Windows.Forms.ComboBox
{
public DropDownBase()
{
this.KeyUp+=new KeyEventHandler(ListKeyUp);
this.SelectedValueChanged+=new EventHandler(PhysicianChanged);
}
public void ListKeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
int index;
string actual;
string found;
if ((e.KeyCode == Keys.Back) ||
(e.KeyCode == Keys.Left) ||
(e.KeyCode == Keys.Right) ||
(e.KeyCode == Keys.Up) ||
(e.KeyCode == Keys.Down) ||
(e.KeyCode == Keys.Delete) ||
(e.KeyCode == Keys.PageUp) ||
(e.KeyCode == Keys.PageDown) ||
(e.KeyCode == Keys.Home) ||
(e.KeyCode == Keys.End))
{
return;
}
actual = this.Text;
index = this.FindString(actual);
if (index > -1)
{
found = this.Items[index].ToString();
this.SelectedIndex = index;
this.SelectionStart = actual.Length;
this.SelectionLength = found.Length;
}
}