Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 491
Eric J Avatar asked Nov 18 '25 13:11

Eric J


1 Answers

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

like image 184
davidsbro Avatar answered Nov 21 '25 10:11

davidsbro