addhandler

Stop SelectedIndexChanged from Firing on Form Load Event

Submitted by admin on

If you are using SelectedIndexChanged in your ComboBox may be you encounter a problem with events being fired even if you did not click the ComboBox.

This happens when you open and close your Windows Form. The workaround for this is to use RemoveHandler statement.

Here’s an example:

How to Prevent Events to Fire More Than Once

Submitted by admin on
[inline:RemoveHandler.jpg=How to Prevent Events to Fire More Than Once]

If you are new to VB.NET most likely you encounter a problem with events like TextChanged or ValueChanged events.

In VB 6.0, change event is not fired when changing a value programmatically. However, in the .NET version this has been changed.

In order to avoid this problem you need to call a RemoveHandler Statement.

The following code is an example of this.