首页 > 编程 > .NET > 正文

Chapter 2 Your First VB.NET(2)

2024-07-10 13:02:34
字体:
来源:转载
供稿:网友
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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表