Miscellaneous Items

Miscellaneous Items

The Visual Basic .NET IDE has a whole host of new features. It also introduces some new behaviors that will take time for Visual Basic developers to get used to. This section walks you through some of those behaviors.

Handling Build Errors

If your project contains compile errors, when you build it Visual Basic .NET shows the dialog box seen in Figure 6-7.

Figure 6-7

Your reward for trying to run a project containing errors.

The only purpose of this dialog box is to let you choose between running a stale build of your solution and fixing the problems and trying again. We can t really see why you d want to make changes and then run a previous build. The vast majority of the time you are going to try to fix the problems first. And that s why you have the Task List.

Using the Task List

The Task List has several different uses. First and foremost, it reports compilation errors. Unlike compiling in Visual Basic 6, you can now view a list of all the errors and fix them in whichever order you prefer, instead of having the order dictated by the compiler, and you can do so without having an annoying dialog box pop up for every error that the compiler comes across. Figure 6-8 displays the Task List for a sabotaged sample application. Double-clicking any of these items brings you to the related line of code. When the issue is fixed, the item in the Task List automatically goes away.

Figure 6-8

Task List.

Of course, the Task List has many other purposes. In the Options dialog box, displayed by choosing Options from the Tools menu, you can select Environment and then select Task List. This dialog box, shown in Figure 6-9, allows you to customize what is displayed in the Task List and gives you the option of adding custom tokens. This feature can be a useful way of marking parts of your application and prioritizing feature areas. For example, you can create tokens that indicate the phase in which features will be added. You could create tokens like Beta1, Beta2, and Beta3 and filter based on the phase of the project you are currently in. You could also create tokens like Bill, Bob, or Janice that indicate areas that individuals on your team need to address. This approach is often useful when implementing large applications.

Figure 6-9

Visual Studio .NET Options dialog box.

These comments would look like this in your code:

'TODO: Do this 'Beta2: This feature needs to be implemented later 'Janice: Can you deal with this?

Using Breakpoints

Breakpoints work the same way they did in Visual Basic 6. Find a line of code you want to break into the debugger on, and either click to the far left of the line in the editing window or right-click the line and select Insert Breakpoint from the shortcut menu. You can remove breakpoints by clicking the red circle or right-clicking the line of code and selecting Remove Breakpoint from the shortcut menu.

References

Visual Basic .NET has two types of references that you can add to your project: a standard reference and a Web reference. A standard reference is used to import the namespace of either a COM type library or a .NET reference. Web references are used exclusively for importing a Web service.

Standard References

As Figure 6-10 shows, three kinds of standard references are available to you through the Add Reference dialog box: COM references, .NET references, and project references. Use .NET references and project references for referencing managed components in your project. Adding a COM reference causes the COM type library to generate a managed type library, thereby enabling the use of COM objects within your Visual Basic .NET project as if they were managed classes.

To open the Add Reference dialog box, right-click the References node in the Solution Explorer, and choose the Add Reference menu item. This opens the Add Reference dialog box as seen in Figure 6-10.

Figure 6-10

Add Reference dialog box.

To remove a reference, open the References node in the Solution Explorer, right-click the reference you want to remove, and choose the Remove menu item.

Web References

To enable your application to consume Web services, you add a Web reference. Adding a Web reference generates a local proxy class that enables you to call methods on the Web service. You add Web references by right-clicking the Reference node in the Solution Explorer and choosing the Add Web Reference menu item. This opens the Add Web Reference dialog box, as seen in Figure 6-11.

Figure 6-11

Add Web Reference dialog box.



Upgrading Microsoft Visual Basic 6.0to Microsoft Visual Basic  .NET
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET w/accompanying CD-ROM
ISBN: 073561587X
EAN: 2147483647
Year: 2001
Pages: 179

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net