如何从VB.NET中的可搜索列表视图中获取文本框值? [英] How to fetch textbox value from searchable listview in VB.NET?

查看:97
本文介绍了如何从VB.NET中的可搜索列表视图中获取文本框值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在一个项目上工作,根据要求,我正在寻找一个解决方案,



有一个groupbox,在groupbox中有一个文本框(txt1)和listview。

现在我在文本框中搜索客户名称(txt1),然后listview显示该客户名来自数据库。当我选择列表视图上的可搜索名称时,所选名称将直接显示在另一个文本框(txt2)上。



当我输入文本框(txt2)时使用文本框(txt1)和列表视图可以看到时间组框,当我点击列表视图上的可搜索名称时,时间组框显示为false,选定值显示在文本框上(txt2)。



如果有人有解决方案,请帮帮我。



谢谢&问候,

vaishali parmar



我尝试过:



我选择了一个组框,在组框中添加了一个文本框(txt1)和listview。当没有任何groupbox的其他文本框(txt2)也在那里时。

Hi,

I have working on one project and based on requirement, I am looking for a one solution,

there is one groupbox and in a groupbox there is one textbox (txt1) and listview.
now when I search customer name in textbox (txt1), then listview display that customername from database. and when that searchable name on listview I select then that selected name is displayed on other one textbox (txt2) directly.

when i have enter on textbox(txt2) that time groupbox is visible with textbox (txt1) and listview and when i click on searchable name on listview that time groupbox visible false and selected value display on textbox (txt2).

If anyone have solution then please help me.

thanks & regards,
vaishali parmar

What I have tried:

I have select one groupbox and in a groupbox add one textbox(txt1) and listview. when other textbox (txt2) without any groupbox is also there.

推荐答案

您可以设置listview.itemselectionchanged来更改文本框中的文本。对于只允许单个选择的列表:



You can set the listview.itemselectionchanged to change the text in a textbox. For a list that only allows a single selection:

Private Sub myListView_ItemSelectionChanged(sender As Object, e As ListViewItemSelectionChangedEventArgs) Handles myListView.ItemSelectionChanged

       If myListView.SelectedItems.Count > 0 Then
           MyTextBox.Text = myListView.SelectedItems(0).Text
       End If


   End Sub





如果您需要允许从列表中选择多个项目,您可以单步执行selectedItems集合并将它们添加到文本框中。



If you need to allow multiple items to be selected from the list, you can step through the selectedItems collection and add them to the textbox.


这篇关于如何从VB.NET中的可搜索列表视图中获取文本框值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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