Bad_Syntax
New member
- Joined
- Sep 2, 2012
- Messages
- 3
- Programming Experience
- 10+
I'm pretty experienced, so I am not looking for any code.
What I am looking for is methods or tricks to help with avoiding infinite recursions on form updates.
For example, lets say I'm building a tank with a form.
I have a dropdown for the weight
I have a dropdown for the mobility type (tracks or wheels)
So I have an event for the value change of weight, which updates the mobility type (too heavy means no wheels).
I also have an event for the value change of the mobility type, selecting wheels means weight will be limited to maybe 30 tons.
If you update the weight, it'll update the mobility, which then updates the weight = infinite recursion.
If you update the mobility, it'll update the weight, which then updates the mobility = infinite recursion.
I've tried all sorts of things, like saving a variable saying "updating" that'll just exit the subs whenever they are called, but when I have 30 or more of these little dropdowns, each modifying maybe a dozen others, it gets to be a real PITA and I end up running thousands of updates for somebody changing a single dropdown.
Some of my other ideas was a timer that did all the updates and not use changed events at all, but it gets weird. I've also thought about creating a class that completely recreates the values of all comboboxes on the form each time any value is updated, but that doesn't feel right.
I end up doing a lot of apps like this, and they always end up killing me as I'm just not "getting something". I've been coding in VB for about 13-14 years, but have never once worked with any other programmers (mostly a hobby, but I have produced lots of things at work too, just never part of a team). Based on that I'm sure I'm just not learning some key things that you would learn when working with teams.
With just a couple dropdowns its easy, but when I have so many of those that all link to various others, well, its not good.
Any ideas on how I can better do updates to forms without calling the same functions over and over?
What I am looking for is methods or tricks to help with avoiding infinite recursions on form updates.
For example, lets say I'm building a tank with a form.
I have a dropdown for the weight
I have a dropdown for the mobility type (tracks or wheels)
So I have an event for the value change of weight, which updates the mobility type (too heavy means no wheels).
I also have an event for the value change of the mobility type, selecting wheels means weight will be limited to maybe 30 tons.
If you update the weight, it'll update the mobility, which then updates the weight = infinite recursion.
If you update the mobility, it'll update the weight, which then updates the mobility = infinite recursion.
I've tried all sorts of things, like saving a variable saying "updating" that'll just exit the subs whenever they are called, but when I have 30 or more of these little dropdowns, each modifying maybe a dozen others, it gets to be a real PITA and I end up running thousands of updates for somebody changing a single dropdown.
Some of my other ideas was a timer that did all the updates and not use changed events at all, but it gets weird. I've also thought about creating a class that completely recreates the values of all comboboxes on the form each time any value is updated, but that doesn't feel right.
I end up doing a lot of apps like this, and they always end up killing me as I'm just not "getting something". I've been coding in VB for about 13-14 years, but have never once worked with any other programmers (mostly a hobby, but I have produced lots of things at work too, just never part of a team). Based on that I'm sure I'm just not learning some key things that you would learn when working with teams.
With just a couple dropdowns its easy, but when I have so many of those that all link to various others, well, its not good.
Any ideas on how I can better do updates to forms without calling the same functions over and over?