Chapter 17. Web Development
Introduction
Programming for the Web is a vast subject worthy of a whole series of books. While we obviously can’t cover everything here, this chapter presents a few web-related recipes for Visual Basic that let you add some useful features to your applications. They will give you some idea of the power of web functionality combined with desktop applications. For a comprehensive collection of Visual Basic web recipes, see ASP.NET 2.0 Cookbook by Michael A. Kittel and Geoff T. LeBlond (O’Reilly).
17.1. Displaying Web Pages on a Form
Problem
You want to display a web page on your form, possibly built from custom HTML content.
Solution
Sample code folder: Chapter 17\CustomWebContent
Sample code folder: Chapter 17\ WebBrowser
Use the WebBrowser
control.
It encapsulates the core Microsoft Internet Explorer engine, and it
integrates easily into your Windows Forms applications.
Discussion
This recipe’s sample code implements a simple web browser.
Create a new Windows Forms application, and add the following controls
to Form1
:
A
Panel
control namedWebToolbar
. Set itsDock
property toTop
and itsSize.Height
property to about40
.A
WebBrowser
control namedWebContent
. Set itsDock
property toFill
. It should only fill below thePanel
control. If it doesn’t, right-click on thePanel
control and select “Send to Back” from the shortcut menu.A
Button
control namedActBack
. This control should appear on the surface of thePanel
control. Set itsText
property to&Back
.A
Button ...
Get Visual Basic 2005 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.