从文件.txt,vb.net搜索信息 [英] Search a info from file .txt, vb.net

查看:85
本文介绍了从文件.txt,vb.net搜索信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.txt文件:
N1 abc
N2 dfg
N3 kjh
N4 2sa
N5 8ds
.....
如何将{N1,N2 ........}加载到组合框?
当我搜索代码时:N1
文本框将显示:N1 abc

I have a file .txt :
N1 abc
N2 dfg
N3 kjh
N4 2sa
N5 8ds
.....
How can i load {N1,N2........}to combobox?
and when i search a code : N1
textbox will show : N1 abc

推荐答案

我说,唯一的方法是解析txt文件并将解析的数据存储到一个类或KeyValuePair中列出或根据您的情况更好的选择,然后遍历您的商品.

您还可以创建类来存储键/值信息,然后重写ToString函数,以便可以根据需要显示数据.

希望对您有所帮助.
I''d say the only way would be to parse your txt file and store the parsed data into a class, or a KeyValuePair List or what''s better in your situation and then just iterate thru your items.

You also can create your class to store the Key / Value info, and then override the ToString function so you can display the data as you desire.

Hope it helps.


将空格分隔符中的文本拆分为文件中的每一行.
然后将返回数组中的第一项添加到下拉列表中.
Split the text on the space delimiiter for every row in the file.
Then add the first item in the returned array into the dropdown.


这篇关于从文件.txt,vb.net搜索信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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