Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ComboBox refreshes ListBox

I have visual studio 2010.

I have a ListBox and a ComboBox, if you select a item from the listbox and after you click the combobox, the listbox refresh. It's like clearing the combobox and adding the items again.

If you open a new project, add a ListBox, add some items to the ListBox, add a ComboBox, run the project, select one item from the ListBox, click the ComboBox and the ListBox for some reason refreshes.

Anyone knows why it happens?

If some can try it, to see if it is an issue with VB, or some setting in my program.

like image 701
user2150033 Avatar asked Mar 08 '13 21:03

user2150033


1 Answers

Found this answer: Listbox flicker when combo box drops down

It suggests using this version of the ListBox (I translated it from c#) and it worked for me:

Public Class MyListBox
  Inherits ListBox

  Private WM_KILLFOCUS As Integer = &H8

  Protected Overrides Sub WndProc(ByRef m As Message)
    If m.Msg <> WM_KILLFOCUS Then
      MyBase.WndProc(m)
    End If
  End Sub

End Class
like image 60
LarsTech Avatar answered Sep 27 '22 18:09

LarsTech