如何使列表框滚动到所选项目 [英] How can I make the list box scroll to selected item
问题描述
大家好,
我有一个文本框,它搜索下面的列表框并选择我在文本框中键入的文本.
I have a textbox that searches the listbox below it and selects the text that I types in the textbox.
现在,尽管已在列表框中选择了该项目,但我还是必须滚动到末尾以查看是否已选择该项目
Now although the item is selected in the listbox I have to scroll to the end to see if the item is selected ornot
有没有一种方法可以使列表框滚动到所选项目?
IS there a way that I can make the list box scroll to the selected item?
推荐答案
使用
YourListbox.SelectedIndex = YourListbox.FindString(textbox.text)
YourListbox.SelectedIndex = YourListbox.FindString(textbox.text)
此消息中可能是拼写错误或其他轻微的不正确的更改,但是当您在代码中进行设置时,会看到它.
Can be typos or other slight non correct changes in this message, but when you set it in your code you will see it.
您也可以使用它确实告诉我们的FindStringExact.
You can also us FindStringExact which does like it tells.
这篇关于如何使列表框滚动到所选项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!