Condividi tramite


Visual Basic Concepts

Understanding Internet Basics

You can program for the Web, using your skills as a Visual Basic programmer, no matter what your level of experience with Internet technology. If you are new to the Internet or unfamiliar with its technology, Visual Basic allows you to quickly and easily produce functional applications. If you are more experienced with Internet technology, you can work at a more advanced level.

From one perspective, Internet technology simply provides another area for your development efforts. When you deploy Internet applications on the Web, you may go about it differently — incorporating HTML pages with your Visual Basic code, providing security features, and so on — but you're still calling methods, setting properties, and handling events. In this way, all of your knowledge as a Visual Basic developer can be carried into the Internet arena.

From another perspective, applying Internet technology enables you to extend your development skills in exciting new ways. For example, writing Visual Basic code that manipulates HTML pages allows you to decrease deployment costs, reduce client maintenance problems, and reach the broad audience of the Internet.

Internet Clients and Servers

A common way to think about Internet development is in terms of client/server relationships. In this case, the client is the browser, and the server is the Web server. Most interactions on the Internet or an intranet can be thought of in terms of requests and responses. The browser makes a request to the Web server (usually to display a page the user wants to see) and the Web server returns a response (usually an HTML page, an element, or an image) to the browser.

Internet vs. Intranet

The Internet encompasses two categories: the Internet and the intranet. The Internet is a global, distributed network of computers operating on a protocol called TCP/IP. An intranet is also a network of computers operating on the TCP/IP protocol, but it is not global. Generally, intranets are restricted to a particular set of users and are not accessible by the outside world. For example, many corporations use a corporate intranet to provide information to their employees, and run another Internet site for external users. Users within the company can access both the intranet sites and the Internet, but users outside the company can access only the company's Internet sites.

HTML Pages

HTML (HyperText Markup Language) is a language that allows you to display documents in a Web browser. You use HTML to create .htm files that are displayed in a browser. When you create an Internet application in Visual Basic, your user interface is usually made up of HTML pages rather than forms. In many ways, an .htm file (which allows you to display HTML pages) is similar to a Visual Basic .frm file (which allows you to display a Visual Basic form).

Note   While the user interface is generally made up of HTML pages, it can also contain a mix of Visual Basic forms and HTML pages.

An .htm file is a text document that contains a series of tags that tell the browser how to display the file. These HTML tags supply information about the page's structure, appearance, and content. The following figure shows the relationship between page in the browser and its HTML tags:

HTML Page and Source HTML

In addition to describing the structural relationships among page elements, some HTML tags also contain attributes. Attributes provide details about a particular tag. For example, the tag that inserts an image onto a page contains an attribute that specifies the name of the file to insert. The tag is shown below.

HTML Tags and Attributes

Internet Object Models

You use the concepts of object-oriented programming in your Visual Basic Internet applications just as you do in forms-based Visual Basic applications. In Visual Basic Internet applications, you use Internet-related object models to access and manipulate information and controls on your HTML pages.

There are two types of Visual Basic Internet applications: IIS applications and DHTML applications. In IIS applications, you make use of the Active Server Pages (ASP) object model to retrieve information from the user, send information to the browser, and maintain information about the current session. In DHTML applications, you use the Dynamic HTML (DHTML) object model to manipulate the elements on an HTML page.

The important point to remember is that you access the information on your HTML pages through objects, regardless of whether the objects themselves are ASP or DHTML. The object models are explained in much greater detail in the chapters describing each type of application.

For More Information    See "A History of Development on the Internet" for more information on the differences between IIS and DHTML applications. See the "Developing DHTML Applications" chapter for more information on using Dynamic HTML objects. See the "Developing IIS Applications with Webclasses" chapter for more information on using ASP objects. See the MSDN™ Web site at https://msdn.microsoft.com/ for details on using HTML and Internet technologies.