vb.netlistboxflicker

vb.net listbox flicker when selecting combobox


I have a listbox that has a combobox next to it. If I select an item on the listbox, and then select the combobox, the listbox flickers. Any ideas on what this could be? There is no code, this only happens when the listbox loses focus. There's no double buffered property for listboxes.

The only other details I can really give you is I'm using WinForms. There has been no code written yet, the listbox is bound to nothing, and the combobox dropdownstyle is set to DropDownList. I just tested on a new project and got the same results.

I should add you'll need to add an item to the Items list in the properties window for the listbox to replicate this.


Solution

  • I think if you force the listbox to redraw itself when it loses focus, this won't happen. I had the flicker problem when I setup a project like you did, and this code fixed it

    Private Sub ListBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.Leave
        ListBox1.Update()
    End Sub
    

    HTH