Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:28:23+00:00 2026-06-15T02:28:23+00:00

I am searching my listview from a specified index and returning the first result(the

  • 0

I am searching my listview from a specified index and returning the first result(the index the item is on) of the word. It works good except I can only search the first column in the listview. How can I search only the second column?

Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal SearchFor As String) As Integer
Dim idx As Integer
Dim It = From i In LV.Items Where i.index > CIndex And i.Text = SearchFor
If It.Count > 0 Then
    idx = It(0).Index
Else
    idx = -1
End If
Return idx
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:28:24+00:00Added an answer on June 15, 2026 at 2:28 am

    I have figured it out. This solution allows you to choose a specified index to begin the search from and checks the column with and index of 1.(Which is usually your second column)

        Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal SearchFor As String) As Integer
        Dim idx As Integer
        Dim It = From i In LV.Items Where i.index > CIndex And i.SubItems(1).Text = SearchFor
        If It.Count > 0 Then
            idx = It(0).Index
        Else
            idx = -1
        End If
        Return idx
        End Function
    

    You could also add another parameter into the function so you could choose a different column to check for the string, like this:

        Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal Column As Integer, ByVal SearchFor As String) As Integer
        Dim idx As Integer
        Dim It = From i In LV.Items Where i.index > CIndex And i.SubItems(Column).Text = SearchFor
        If It.Count > 0 Then
            idx = It(0).Index
        Else
            idx = -1
        End If
        Return idx
        End Function
    

    To use this function, it would look like this:

         FindLogic(Listview1, 1, 1, "Dog")
    

    You could also have it search from a selected item like this:

         FindLogic(Listview1, 1, LV.SelectedIndices(0), "Dog")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Searching from google.com, like www.abc.com Search Result Rank the pages like Title..... Description... www.abc.com
I am using expandable listview i need to refresh as i am searching the
When I try searching the list view it should scroll to the obtained result
Searching a Python dictionary based on the value first, to get a key output
I have been searching for a way to get the json data from a
I have a ListView. When I select an item in the ListView, I would
You can locate the place by searching test11 in the page, but if you
i'm having trouble searching a virtual listview in c#. what i am doing right
I have a listview in which I am getting values from base adapter.what I
Can any one help me..?? My problem is that, after getting response from json

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.