Creating Visual Basic Components for the Web
- Creating Visual Basic Components for the Web
- Making a Web-Aware ActiveX Custom Control
- Understanding Custom Controls and Asynchronous Transfer
- Working with UserControl.AsyncRead
- Downloading a Graphic
- Understanding Properties in Terms of AsyncRead
- Working with the FileSystemObject
- Compiling the Custom Control
- Packing the Custom Control
- Deploying the Custom Control with a Sample Page
- Updating the Custom Control
- Conclusion
The legacy of Visual Basic is that of standalone desktop applications running under Windows, but as the language has grown, so has the scope of the environments in which it can be used. This is particularly the case with regard to programming for the Internet. Microsoft was well aware of the importance of the Internet and the role that Visual Basic needed to play in Internet development when the company was introducing Internet Explorer version 3; you could use VB 5 in conjunction with IE 3 to do reasonable Web programming.
Visual Basic 6 made a quantum leap forward. You can use VB 6 to work on either the client side or the server side in order to add a level of functionality to your Web site that is only possible through hard-core, language-level programming. Today Microsoft is positioning VB as a reasonable and even preferable alternative to Java. In fact, VB 7, slated for release next year, will address many of the previous shortcomings that have influenced developers to look to Java to meet their programming needs. You can do significant programming for the Web using VB, and this capability to do more significant programming will grow as the language grows.
In this article, I show you how to make a Web-aware custom control that you can run in a Web browser or a standard Visual Basic form. I'll show you various features that allow you to get data into a custom control directly from the Internet and process it once it’s downloaded. Also, I'll demonstrate how to embed the custom control in a Web page and, lastly, how to package a Web-aware custom control for deployment on the Internet.
I assume you have enough Visual Basic knowledge to create a custom control, and that you understand the UserControl object. Lastly, I assume you understand the fundamentals of Internet development, how data gets around the Internet, and that you recognize the significance of a URL in locating and retrieving data.
You can view a working copy of the custom control created for this article by going to this URL: http://www.CogArtTech.com/Informit/Informitcc.htm.Be advised that you must be running Internet Explorer, Version 4 or higher to view the custom control. Netscape Navigator does not support embedding ActiveX Controls in a Web page. The working copy of this control does not have a digital signature. Therefore, you need to configure the Security setting of Internet Explorer to Low in order for the control to work on your browser. If you are hesitant to use an unsigned control, you can download the code from the InformIT site.