• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 124
  • Last Modified:

Two in one i guss

I have a list box and a text box, i would like to set the list box and the text box up to function in a similer manner to the combobox. So if for example the list box was a list of words sorted and i started to type the work play into the text box i want to scrol the list box to the p section and the the pl section and so on. Any ides on how to do this. The second part of the question is to do with the first list box, i would like to set the tool tip text to the same as what the mouse is over at the time. Any help will be great, i have vb6 if that helps.
0
kplonk
Asked:
kplonk
  • 4
  • 3
1 Solution
 
vettrangerCommented:
Go to the following site and get to the draglist control. It has a quick search method that does what you want with the first part of your question. This will be much better than the alternative, which would be to loop thru your list matching the contents of the textbox to items in your list using the length of the textbox text.

http://www.mvps.org/ccrp/
0
 
vettrangerCommented:
Then, add the following code to the mousemove event of the above listed draglist control to get the 2nd part of your answer.

Dim item As Integer
item = ccrpDragList1.TopIndex + (Y / ccrpDragList1.ItemHeight)
ccrpDragList1.ToolTipText = ccrpDragList1.Contents(item)
0
 
kplonkAuthor Commented:
thanks this worked great
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
vettrangerCommented:
Happy to help! :-) It just struck me on the 2nd part. After you computer item, compare it to the listcount property of the list box (and probably listcount-1) before setting the tooltip. Altho I didn't try that, it might be possible to get a number greater than a valid index into the Contents collection if the listbox is only partially filled and the mouse moves into the empty area below the list.
0
 
kplonkAuthor Commented:
yes you can but this is no proble as i have sorted it with a simple error handler, all is well thanks a lot see you later.
0
 
vettrangerCommented:
Well done :-)
0
 
kplonkAuthor Commented:
Hello vettranger, i have a question for you i will give you some points if you are able to help. I would like to make the list control tht you sujested to me do a few more things, for example if i was on item 10 of 40 in the list and all 40 were displayed, when i press the page down key i would like to make the box scrol so that item 10 was now on the top of the list box. I would like to make the sam thing happen for the page up key. any ideas
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now