当前位置:编程学习 > C#/ASP.NET >>

Chapter 2 Your First VB.NET(2)

答案:Figure 2.3
The New Project dialog box.
If you examine the Visual Basic project types, you’ll see that many of them are dif-ferent
from what you are used to with VB6. Some of the major project types are
• Windows Application—This is a standard executable, in VB6 terminology. It is
the way to create applications with a Windows interface, using forms and con-trols.
This is as close to “your father’s VB” as you’ll get in VB.NET.
• Class Library—This project type allows you to create classes that will be used
in other applications. Think of it as similar to the COM components that you
have been building, which VB6 called the ActiveX DLL and ActiveX EXE pro-ject
types.
• Windows Control Library—This project type is for creating what used to be
called ActiveX controls. This type allows you to create new controls to be used
in Windows applications.
• Web Application—Goodbye, Visual InterDev. Goodbye, server-side, interpreted
scripting languages for Active Server Pages. Visual Basic now has Web
Application projects, which use ASP.NET to create dynamic Web applications.
These projects allow you to create HTML, ASP.NET, and VB files. You will
now code your Web applications using a powerful, event-driven model instead
of the request/response model.
• Web Service—If you’ve used VB6 to create COM components and then made
them available over HTTP with SOAP, you understand the concept of Web
Services. Web Service projects are components that you make available to
other applications via the Web; the underlying protocol is HTTP instead of
DCOM, and you pass requests and receive responses behind the scenes using
XML. Some of the major promises of Web Services are that they are all stan-dards-
based and are platform independent. Unlike DCOM, which was tied to a
COM (that is, Windows) infrastructure, Web Service projects can be placed on any platform that supports .NET, and can then be called by any application
using just the HTTP protocol.
• Web Control Library—As with Web Service projects, there’s no exact match
back in VB6 for the Web Control Library projects. Thanks to the new Web
Application projects in VB.NET, you can add controls to Web pages just as you
would in a standard Windows Application project, but VB.NET makes them
HTML controls at runtime. You can design your own controls that can then be
used by Web applications.
• Console Application—Many of the Windows administrative tools are still con-sole
(or command-line, or DOS) applications. Previously, you didn’t have a
good way to create console applications in VB, and instead had to rely on C++.
Now, console applications are natively supported by VB.NET.
• Windows Service—As with console applications, there was no good way to
create Windows services in previous versions of VB. Windows services, of
course, are programs that run in the background of Windows, and can automati-cally
start when the machine is booted, even if no one logs in.
Those are the basic types of applications you can create. You can also create an
Empty project (for Windows applications, class libraries, and services) or an empty
Web Application (for Web applications).
Examining the IDE
If you are still on the New Project dialog, choose to create a Windows Application.
Name it LearningVB and click the OK button. After a time, a new project will open
up. Notice this adds a Form1.vb tab to the main window. In the main window, you
now have an empty form. This is commonly referred to as the Form Designer. In fact,
there are various types of designers that can get loaded into this work area. So far,
you should feel pretty much at home.
One difference that has occurred, perhaps without you noticing, is that the files cre-ated
have already been saved on your machine. In VB, you could create a project, do
some quick coding, and then exit without saving, and nothing was stored on your
machine. Now, however, the files are saved at creation, so each project you create
does store something on the hard drive. Visual InterDev developers are used to this,
but straight VB developers will see this as a change.
If you look at the right side of the IDE, you’ll see a window called the Solution
Explorer. This works like the Project Explorer in VB6, showing you the projects and
files you have in the current solution (what VB6 called a group). The Solution
Explorer currently lists the solution name, the project name, and all the forms and
modules. Right now, there is just one form, named Form1.vb. In addition, the win-dow
will have a file called AssemblyInfo.vb, which is part of the metadata that will

上一个:从Windows DNA到.NET(2)
下一个:Chapter 3 Major VB.NET Changes(1)

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,