4
Answers

Suspend Combo Box Event

Ryan Kotowski

Ryan Kotowski

14y
4.7k
1

Hello,
  I am not an expert in VB.NET by any means.  I just converted our VB 6 program to VB.NET in the last several months.  In VB.NET, there are several events that I am utilizing that I didn't necessarly use before.  Almost all of my combo boxes use the Click, KeyDown, LostFocus and SelectedValueChanged events.  These are great when needed, but they slow everything down when I load up the form.  I have dozens of combo boxes in my program...especiall my second screen.
  I could be doing the Form_Load wrong, but when the form comes up I load the combo boxes using Items.Add.  But, that always triggers the above events.  Because of this (partly), my screen takes some 25-30 seconds to load.  Since those events are unnecessary at Form_Load time, I was trying to figure out how to bypass them just in the Form_Load section.
  I searced the internet the last 2 days for an understandable solution, but my limited VB knowledge maybe was getting in my way.  Remove/Add Handler seemed to be a popular choice, but I don't know if that is what I should be using.  If it is, what is a simple example of how to use them?  I appreciate any help at this point.  I have rolled out the program and I am getting a lot of grief for this long pause they are dealing with.
 
Thanks in advance,
Ryan
Answers (4)