如何使用c#.net在usercontrol listview中实现自动完成 [英] How can I achieve auto complete in usercontrol listview using c#.net

查看:73
本文介绍了如何使用c#.net在usercontrol listview中实现自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮我找到解决方案...我试过很多..无法找到.. plzz plzzz帮帮我



我试过的:



public void match()

{

listView1.SelectedItems.Clear() ;

listView1.FindItemWithText(mtch).Selected = true;

}

help me to find the solution... i tried alot..bu unable to find..plzz plzzz help me

What I have tried:

public void match()
{
listView1.SelectedItems.Clear();
listView1.FindItemWithText(mtch).Selected = true;
}

推荐答案

- 你需要一个单词列表,称之为
-You need a list of words, call it
_DATABASE



- 您需要一个文本框或类似文件,称之为


-You need a textbox or similar, call it

_SEARCHBOX



- 例如,如果输入A,则在


-If you enter 'A' for example, add code functionality on

TextBox_KeyPress_EVENTHANDLER


$ b上添加代码功能$ b并检查_DATABASE中与第一个字母A ......匹配的所有项目。

您可能需要设置'


and check for all items in your _DATABASE that match the first char 'A....'
you may have to set '

KeyPreview to True

'生成按键事件

- 创建一个ListBox,称之为

' to generate keypress events
-create a ListBox, call it

_MATHCES



将它放在_SEARCHBOX旁边。每次你写一个角色,它都会更新_DATABASE的所有可能的匹配项目

它的简单数学,但它有点工作。


place it next to your _SEARCHBOX. Every time you write a character, it will update all possible matching items of your _DATABASE
Its simple maths, but its a bit of work.


这篇关于如何使用c#.net在usercontrol listview中实现自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆