Results 1 to 6 of 6

Thread: [2005] listview column computation

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    [2005] listview column computation

    i use timer control to compute the value of 2nd and 3rd column of a listview.
    the problem is; the listview blinks everytime the timer perform computation.
    the timer interval is 1;

    kindly help me to avoid blinking of listview everytime it computes the value of 2nd and 3rd column?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] listview column computation

    The SuspendLayout and ResumeLayout methods on the listview may help reduce your flicker.

    Call the SuspendLayout, do your work, then call ResumeLayout.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] listview column computation

    the timer interval is 1;
    That is very, very bad. You are performing your calculation 1000 times a second. It's not that the ListView blinks EACH time. The problem is that you're doing it so frequently that the ListView doesn't even get a chance to repaint some times. Be realistic about the frequency with which you perform this calculation.

    What are you calculating anyway? It may be that you don't even need a Timer at all but can instead use an event to recalculate only when the result may have changed. That's far more efficient.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] listview column computation

    Code:
    Call the SuspendLayout, do your work, then call ResumeLayout.
    how can i code or do it to avoid flickering?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] listview column computation

    Quote Originally Posted by arshesander
    Code:
    Call the SuspendLayout, do your work, then call ResumeLayout.
    how can i code or do it to avoid flickering?
    DON'T UPDATE THE CONTROL 1000 TIMES PER SECOND.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] listview column computation

    Instead of PMing me a few times, why don't you post what you have tried. Also, have you followed JMC's advice and lower the number of times you are refreshing the listview.

    Noone is going to do the work for you, you need to make an effort and let us know the results.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width