My interface has two popup menus.
When one changes index i want the other to have the same index.
So changing one effects the other.
So do I just set the index of the other control in each controls selectionchanged event?
Isn’t this going to cause all kinds of events to fire?
You will need to set a boolean flag to prevent the menu which you set in code from firing its change event when you set it.
Dim prohibitSet As boolean for example as a window property.
If not prohibitSet Then
//go ahead an do the change event stuff
OR just check if the other one already has the right value already before setting it- that would prevent circular events… and that way you don’t need an extra property.
But I’m not even sure if you need that in this case … If you set a PopUpmenu index to what it already is (so it’s not really changing) does the changed event fire? I not you don’t have to worry about it… Easy to test!
No. The change event will not fire unless you change the ListIndex. But if the Index is NOT the same, it will fire and you get events you don’t want. He needs to prohibit the event from firing in that case. Why have to check for 2 things?
Ah I was just thinking about synchronization… If they trigger different events even though the indexes need to be synchronized, I would think you would want them both to fire once on a change… But if they trigger the same actions then no.