Thursday, October 16, 2008

Stop flickering + Blinking in VB.Net winforms

Following are some tips to stop Flickering in Winforms
1. Use following API method
Imports System.Runtime.InteropServices
Public Declare Function LockWindowUpdate Lib "user32.dll" (ByVal hwnd As Integer) As Integer
LockWindowUpdate(Me.Handle.ToInt32)
'Do Something
LockWindowUpdate(0)
2. Stop ListView Flickering
Listbox1.BeginUpdate()
Listbox1.Items.Add"New Item")
Listbox1.EndUpdate()