I have inherited a frankenstein VB6 "Converted" to VB.NET winform application. This application has a metric ton of fields in it, the users rightfully complained that the tab order is off (after a certain point it starts jumping all over the form).
Figuring something in tab order was off, I went in and turned on View > Tab Order and it looked good.
To be sure I went through the form again fresh and when I'm in tab order view all is well, but when the app runs it still starts jumping around the same area as before?! Has anyone else encountered this and how did you resolve if you did?
[Edit]: These input forms are all on separate tabs within a tab control, which probably muddies the situation even more.
Are there any strange Focus calls in the code that are overriding the tab order and setting the focus of the application manually?
I've had problems in the past with tab ordering getting itself all confused and I've usually just resorted to going through the application from scratch and setting the order myself manually. I realise that this may well not be what you are looking for but I don't know of anything else
If you have many controls on a form chances are that they are organized with containers such as panels and group boxes. When setting the tab order you have to consider the order of the containers as well. An inconsistency between tab orders on in the containers could explain the weird jumping. This can happen especially if two or more controls/containers have the same tab order value which makes the tabbing process arbitrary.
Solution Idea: Of course updating and correcting the tab order is slow, error-prone work. It may behoove you to write a routine that iterates through the form's containers and controls recursively and assigning tab order values properly. You would set the tab order by comparing the Location point of each control of the container where top and left most point is the "lower" rank and the bottom, right-most component is the "highest". This would of course need a custom sorting alg. And if you look around, something like this may already be out there.
Solution Idea 2: Refactor! Divide and conquer. It will take some time but if you move the UI components into separate, logically-organized user controls you'll get tighter of the codebase. You'll also uncover a lot of bugs!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With