惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 妖居

ASP.NET MVC Tips #2 - 令人混乱的Get、Post、Return View和Return Redirect ASP.NET MVC Tips #1 - 支持上传文件的ModelBinder How to migrate MsSql database to MySql Windows Workflow Foundation 使用小例 使用异步委托解决Windows Application应用Duplex Service时出现的Deadlock问题 字节数组、数值和十六进制字符串的转换 表格化固定长、CSV文件编辑器工具 iMatrixitor 发布 Getting Started With LINQ in Visual Basic (翻译 + 评论) 使用接口实现附带插件功能的程序 两个简单方法加速DataGridView 使用.NET自带的功能制作简单的注册码 不是说“Peek 不会更改 StreamReader 的当前位置”么。MS骗人的! 《Introducing Visual Basic 2005》中看到的一些VB2005的新特性 VB.NET函数的返回值问题(从CSDN论坛一个问题想到的) Add-in and Automation Development In VB.NET 2003 (Finished) Add-in and Automation Development In VB.NET 2003 (8) Add-in and Automation Development in VB.NET 2003 (6-7) 在WinXP环境下显示XP风格的控件 Add-in and Automation Development In VB.NET 2003 (5)
模拟IE地址栏的TextBox小控件
妖居 · 2005-04-19 · via 博客园 - 妖居

记得CSDN上面以前曾经有人问过,有没有像IE地址栏那样能够自动记忆以前输入过的文字,然后通过下拉列表选择的控件。我的印象是.NET没有提供这样的控件,众多.NET高人肯定做过,但是我一时找不到。这几天无聊,于是自己试着做了一个。

主控件是一个继承自TextBox的类,然后一个成员控件ListBox。一个ArrayList保存了所有用户曾经在这个TextBox里面输入过的内容。

Public Class ComboTextBox

    Inherits Windows.Forms.TextBox

Private WithEvents lbInput As System.Windows.Forms.ListBox

Private m_ComboList As ArrayList

End Class

TextBox.Enter的时候,自动显示ListBox,并且根据用户在TextBox里面已经输入的内容查找ArrayList里面的项目,通过String.StartWith方法提取符合的项目,然后添加到ListBox里面。(如果TextBox里面没有任何文字,就全部显示所有的ArrayList里面的内容)

For Each item In Me.m_ComboList

If item.ToLower.StartsWith(header.ToLower) = True Then

Me.lbInput.Items.Add(item)

End If

Next

TextBox.Validated的时候,将用户输入到TextBox里面的文字作为合法的输入文字添加到ArrayList里面去。同时隐藏ListBox

这个小控件是一时高兴做的,所以没有特别全面的测试。我把源代码放上来,欢迎园子里面的哥哥姐姐们给我指点指点。如果您有什么更好的想法,非常欢迎Feedback

源代码和Sample合并在一个Solution里面下载