Visual Basic Power Pack


Starting in 2005 Microsoft released a Power Pack which gives VB.NET access to many great components that VB6 users where used to such as: Shapes, DataReader, PrintForm, etc. This tutorial gives some examples of these controls and how you can make use of them when developing great Visual Basic .Net applications.

Using the Microsoft Visual Basic Power Pack 3.0

The Microsoft Visual Basic Power Pack 3.0 component adds back to VB (versions 2005 and higher) a set of controls that were available in pre-.NET versions of VB (i.e. VB6) but removed in the first versions of VB.NET (2002 / 2003). Included in the power pack are the basic shape controls (line, oval, and rectangle), a PrintForm component, and the DataRepeater control. The shape controls enable you to enhance your form's layout by simply dropping one of these controls on the form (in earlier versions of .NET you would have to use the System.Drawing class and write code to draw a simple shape on your form). The PrintForm component enables you to easily print an image of your form. The DataRepeater control would be used in a database application to display rows of data in a scrollable container.

The PrintForm component will be demonstrated in the tutorial on forms and the shape controls will be used in a number of upcoming tutorials and sample applications.

To get the power pack, go to this web page (a screen-shot of the page is shown below):


Once you download the power pack from the page shown above, install it as you would any other software. At that point you will then be ready to add the controls to your VB toolbox. The information given below shows how you would incorporate the power pack controls into your VB toolbox using VB 2005 Express Edition. The way to do this using other editions may vary slightly, but the concept is the same.

First, open up VB, right-click in an empty area of the toolbox, and select Choose Items ... from the context menu:


The Choose Toolbox Items dialog box will appear. Click the Browse button:


A standard Open dialog box will appear. Navigate to Program Files\Microsoft Visual Basic 2005 Power Packs\3.0 and double-click on Microsoft.VisualBasic.PowerPacks.dll.


The Open dialog box will close. Back on the Choose Toolbox Items dialog, click on the Namespace column to sort the components by Namespace, and scroll down until you see the Microsoft.VisualBasic.PowerPacks items. Check the items using the checkboxes on the left and click OK.


At this point the controls will be added to the toolbox:


You can then add the controls to your form as you would any other control:


Shape Control Bug

There is a bug, acknowledged by Microsoft, with the shape controls. The bug has to do with the Name property. If you are using the shape controls purely as GUI elements and will NOT be referring to the control in code, then this issue is of no concern. However, if you will be referring to the control in code (as is done in the Tic-Tac-Toe application, for example), then you need to be aware of the bug and how to fix it.

In the screen above, the shape controls were named myLine, MyRec, and myOval. However, the form designer may "miss" a control or two, and internally retain the default name (like "OvalShape1") even though you see the name you gave the control (myOval in this case) on the property sheet. If you refer to one of the misnamed controls in your code, a run-time error will most likely occur. To ensure the designer "got them all right", you can click the "Show All Files" button on the Solution Explorer, and then open the ".Designer.vb" file of your form.  As you can see in the screen-shot below, "myLine" and "MyRec" are fine, but "myOval" is wrong – the designer did not set the Name property to my new name. The remedy here is, on the circled line, change "OvalShape1" to "myOval".


After you have made any necessary corrections, you may want to toggle "Show All Files" back off as a safeguard against inadvertently modifying the designer files and other files that you would normally not edit. (Making the correction shown here is an "exception to the rule" – you do not normally want to modify the form's Designer.vb file.)

This article was originally written by The VB Programmer.

If you enjoyed this post, subscribe for updates (it's free)

red bottom shoes

It supplies you with a neverending supply of campaigns that profit using artificial exciting techniques For sampling, you can once again go with matte as they prove to michael kors handbags be slightly more cost effective that their other counterparts Decide today to embrace renewable energy of some kindThere Louis Vuitton Sale are literally 1000s of these clubs around the World and most certainly in your own nearest town or gucci purses City with their popularity increasing each year People buy because of emotions and copywriting runs on emotions That's louis vuitton store because, the least favoured method was to contact supporters via a personal welcome call? ABC Window Company resides in louis vuitton Ontario, Canada? Barber and Ross Co You can have the best gadgets around, but it won't matter if there Authentic Louis Vuitton Bags are no people who are able to use it properly When it became apparent that working as a louis vuitton outlet online muffler salesman will not pave the way to his dreams, he moonlighted in online business The beneficial thing michael kors outlet online dealing with these online suppliers is that you can take vantage of the certainty that you can order louis vuitton outlet online a general product contingent on the magnitude of dough you will be capable to spend for it When cheap louis vuitton bags moving around for a leather bag, examine for an internal lining in the bag You can opt for louis vuitton bags any type of drinkware imaginable, from beer mugs to shot glasses to champagne flutes, and all are available louis vuitton outlet in a variety of colors What may not have affected you in the past may now get acute Christian Louboutin your Sjorgen's syndrome symptoms And that is if you are looking for an affordable way of advertising your michael kors purses business In many cases this is the most difficult part of the company attracts many of the best louis vuitton outlet store shots are unpleasant to use A lock is a mechanism that secures buildings, rooms, automotives, cabinets, objects, or michael kors other storage facilities One that is designed for answering machines and voicemail as well as one that has michael kors outlet been recorded for calls that are answered by a live person The solid pieces of dirt stuck louis vuitton outlet at gucci outlet online the window are taken off using a razor blade Now, you need to put place cards on the dinner table Majority of the lending companies also have connections to financial experts, thus buyers can ask for Christian Louboutin outlet online assistance to these experts

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.