Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 3-Oct-18 8:54am

1 solution

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


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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900