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 8683919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:09:57+00:00 2026-06-12T22:09:57+00:00

i’m having trouble searching a virtual listview in c#. what i am doing right

  • 0

i’m having trouble searching a virtual listview in c#.

what i am doing right now is reading a large log file. here is what i have implemented so far

I read the file one line at a time and note the position of the start of the line. Add these positions to a List and when RetrieveVirtualItem is called – look up the position in the file using the index of the item and the List and then read the line from file.

So there is no lag when reading the file.

I want to now search for items. Here is what I have thought of so far, but I have not been able to implement it successfully.

I am not actually searching the listview, but during my filereading, i mark the position of hits of the specific string, say “INFO”. if it hits, i add the position to a List.

When RetrieveVirtualItem is called, I just read the line back with all the hits.

Seems that through debugging – if (line.IndexOf("INFO", StringComparison.OrdinalIgnoreCase) >= 0) is not hitting any matches. I’m not sure why, anyone help?

using (var sr = new myStreamReader("test.log"))
{
    while ((line = sr.ReadLine()) != null)
    {
        if (line.IndexOf("INFO", StringComparison.OrdinalIgnoreCase) >= 0)
        {
            position = sr.BytesRead;
            Search.Add(position);
            searchcount++;
        }
    }
    newMessageView.VirtualListSize = searchcount;
}
  • 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-12T22:09:58+00:00Added an answer on June 12, 2026 at 10:09 pm

    I don’t know how your “myScreamReader” class works, but if it similar to StreamReader this code could be working for you:

    using (var sr = new StreamReader("test.log"))
    {
        while (!sr.EndOfStream)
        {
            string line = sr.ReadLine();
            if (line.IndexOf("INFO", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                // line contains "info"
            }
        }
    }
    

    You should debug your code by setting a breakpoint at line.IndexOf… check to see if value of line is changing and look correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a reasonable size flat file database of text documents mostly saved in
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.