| New Upgrade Wizard Tricks | ||
| Part 4: Converting a Control Array: A Better Way | ||
|
One way to go would be to use the enhanced capability of the Handles keyword in VB .NET to handle every button with the same subroutine. Here's what this looks like in code: The buttons are not part of a Control Array anymore. They're grouped only because your code specifies that the same subroutine should be called for all of them. When you think that, first, you can process any collection of form controls with the same subroutine, not just identical buttons like VB 6 allows. And, second, you have a much richer set of events to choose from (57 versus 17 as a raw count for buttons), VB .NET provides a lot more capability to help you get the job done. The verdict on the Upgrade Wizard isn't quite as positive, however. Think of it as one of those emergency spare tires they put in cars these days. Useful in a pinch, but not the kind of thing you want to depend on for the 'long haul'. For that, you need to learn how to be your own Upgrade Wizard! |
||

