| You are here: | About>Computing & Technology>Visual Basic> Using VB.NET> VB.NET: What Happened to Control Arrays!!! (Part VII) |
![]() | Visual Basic |
VB.NET: What Happened to Control Arrays!!! (Part VII)Clif Gay's compatibility library based solutionHere we go again! But a little history is in order. Almost two years ago, I published a question from an About Visual Basic reader about how to implement the beloved and sorely missed Visual Basic 6 Control Array in VB.NET. VB.NET doesn't support VB 6 style control arrays directly, but Microsoft has provided a "recommended" way to do the same thing and in my first article, I just explained the Microsoft recommendation. Little did I know how many readers would send in increasingly sophisticated and inventive ways to duplicate the functionality of the VB 6 control array! To date, there have been six articles! Here they are: VB.NET: What Happened to Control Arrays!!! (Part I) Clif Gay, an Engineering Specialist / Programmer in the R&D Engineering department of Anaren, Inc. has sent in yet another way to do it. Explaining his idea is a great way to review a part of VB.NET that hasn't been discussed much recently, the Compatibility.VB6 namespace in VB.NET. And Clif's idea also provides a great reason to discuss some of the changes that have been made in Visual Studio 2005. To show my appreciation to Clif, I'm sending him a copy of the only book (so far) to be rated "5 stars" in the About Visual Basic review of VB.NET 2005 books: One of the big advances in .NET is that all of the code that is in your application is now open to you to see. In VS 1.X, this is in the hidden "Region" code. See Regional Issues - What's in the hidden Region in VB .NET? for an explanation of Region code. In VS 2.0, this is in the component name.Designer.vb file that is hidden by default in the Solution Explorer window. Click the Show All Files button to display it. Clif wrote that he discovered his idea by studying this hidden code that Visual Studio generates - a clear demonstration of the value of having it available rather than buried in the system code as it is in VB 6. In fact, I suggested that this could be tried way back in the very first article I wrote about simulating VB 6 control arrays way back in the very first article I wrote about it: "If you reference the VB6 compatibility library, there are objects in there that act pretty much like control arrays. To see what I mean, simply use the VB.NET upgrade wizard with a program that contains a control array." Clif went above and beyond and figured out how to use this code. Microsoft documented a different way to do the job. But, due to changes in the way Visual Studio 2005 and VB 2005 Express now manage generated code, their solution doesn't work too well today. Both Clif's idea and the Microsoft recommendation require a modification to Visual Studio generated code. But today, VS 2005 overwrites any changes you make whenever a change is made to the form. If the link above stops working, it's probably because Microsoft has removed the article from MSDN when they figured out that following their advice creates problems. Clif has figured out how to overcome the problem and adds some new techniques that have not been explored before. Let's see how Clif's idea works. ps ... This article was developed and tested with Visual Basic 2005 Express Edition (VBE in this article). Clif uses "top of the line" Visual Studio 2005 Team Edition. So between us, we've got you covered. |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


