Click here to Skip to main content
15,031,495 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have do lots googling but I did not get right solution to stop flickering in listview as I am stop flickering in richtextbox but I did not stop flickering in listview.

following code I used to stop flickering in Richtexbox...it is works for me..

C#
[System.Runtime.InteropServices.DllImport("user32.dll")]
        private extern static IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

//below code reloaded after every 2 seconds...

SendMessage(RichText_MessageData.Handle, 0xb, (IntPtr)0, IntPtr.Zero);
//doing some changes in richtextbox...

SendMessage(RichText_MessageData.Handle, 0xb, (IntPtr)1, IntPtr.Zero);
            RichText_MessageData.Invalidate();



and I am using below code to stop flickering in listview.....It is not worked..
C#
SendMessage(lv_employeelist.Handle, 0xb, (IntPtr)0, IntPtr.Zero);
//adding rows in listview in every 2 seconds..
SendMessage(lv_employeelist.Handle, 0xb, (IntPtr)1, IntPtr.Zero);
            lv_employeelist.Invalidate();


What I am done here wrong...
Posted

1 solution

Hi, you might want to consider running code to update your UI in a separate thread to the main thread of execution.

I have experienced similar problems with Winforms before and have found that the flickering behaviour you described is usually caused when you're trying to update your UI whilst performing another operation.
   
Comments
rajesh@1989 17-Jun-13 1:39am
   
Thank you Laurence!! and many many thank to Jonas
I got the solution...by using Jonas answer http://stackoverflow.com/questions/87795/how-to-prevent-flickering-in-listview-when-updating-a-single-listviewitems-text

I will soon update the exact answer for it.

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