HI all

i am working on a project where i am adding login and password. Also i add button if someone forget his\her password so they can able to retrive it. for this i put 2 textboxes one is email and other is username which will retrive data from listview. now i know how to search item with below code

        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).SubItems(0).Text = TextBox1.Text Then
                ListView1.Items(i).Selected = True
                MsgBox(" Found'")

            End If

but i want that when item found the message box must appear showing column1(username) and column2(password)

how to do that


If the user name is in column 1 and that is what you are using to match against your text box then you already have the code via the SubItems property and can use this in your message box.

MessageBox.Show(String.Format("Username: {0}, Password: {1}", ListView1.Items(i).SubItems(0).Text, ListView1.Items(i).SubItems(1).Text))

You will also need to add an Exit For once you have found your match otherwise you will be looping unnecessarily once a match is found.