Need a Listbox to mimic the combo dropdown list

  • Thread starter Thread starter Steve Le Monnier
  • Start date Start date
S

Steve Le Monnier

I have a textbox with a lookup button facility. What I would like to do is also offer a quick selection facility by having a dropdown list appear under the control once the user has typed a single character. The same kind of functionality that you see on website textboxes these days.

I don't want to use a combo, but I do like the fact that the dropdown list from a combo is highlighted by moving the mouse. Is it possible to make a standard listbox behave like this.

I did try the hover select of a listview control, but it was nasty.

Many thanks

Steve Le Monnier
 
Thanks for the info.

I've looked at that and I'm not to worried abou find the items in the list
box, the effect I'm trying to acheive is that of the blue bar that follows
the mouse when you move it over the records. Just like it does with the
combo drop-down list.
 
Hi Cor

I've found the solution I was looking for, so many thanks for your help. The solution itself was realy elegent and I'm kicking myself for not find it first. Anyway in the spirent of cooperation he is the code that's put a smile on my face.

private void listBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
listBox1.SelectedIndex = listBox1.IndexFromPoint(e.X,e.Y);
}

Many thanks

Steve
 
Back
Top