Review Questions


What is the first step when designing a new control?


The first step is to determine that the control doesn't already exist. Very often the most cost-effective way to implement a new control is to buy it. This is particularly true for commercial software development. If you cannot find exactly what you want in the market place, the next step is to determine if you can extend an existing control to suit your needs. More often than not, you can use inheritance to expand the functionality of an existing control. The last resort is to write the control from scratch.


If you have the Standard Edition of Visual Basic .NET and wish to develop your own controls, how can you develop your own controls?


You can't. Your only alternative is to upgrade your version of Visual Studio.


What control considerations should you make part of your control's design?


It's very easy to lose sight of the fact that consistency is crucial to programmer productivity. Earlier Visual Basic controls use names like Title, Text, and Caption to write textual information on the control. Even after years of experience, I still had to look up which was which for controls I didn't use that often. Visual Basic .NET does a much better job by consistently using the Text property for text that is displayed on a control. As much as possible, follow the lead set by other controls when defining its properties.


Looking at the IDE, it appears that developing a control and developing a program are the same. What's the difference?


A major difference is that when you are finished developing a control, you have a dynamic link library (DLL) file that you can use in other programs. The result of control development is not an executable program.


How do you make the component attributes of a control available to the programmer?


You must include the statement:

 Imports System.ComponentModel 

in your code to allow the programmer to interact with your control via the Properties window.


How do you make a custom control available for inclusion in a program?


You need to make Visual Basic .NET aware that the control exists. The easiest way to do this is by placing the new control on the toolbox. To do this, right-click on the toolbox and select the Customize Toolbox option. Now select the .NET Framework Components tab and click the Browse button to locate and select the dynamic link library file that holds the custom control. Visual Basic .NET now adds the custom control to the toolbox. From that point on, you use the control like any other control on the toolbox.

Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: