|
|
![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
Building Online Help Into Your ApplicationThe Testing Department is calling again. The companys software is changing too fast to keep up with creating new Help files and sending them out to users all the timewhat can we do? You suggest, how about some online Help files? You can build support for online Help files into Visual Basic applications easily by using the Web browser control. Using that control, you can connect the users directly to the company Web site and let them view Help files in HTML format. Lets see an example. Using the Visual Basic Application Wizard, create a new project named onlinehelp. When the Application Wizard asks about Internet connectivity, as shown in Figure 30.19, click the Yes option button and enter the Help Web page you want to display to the user as the startup page for the programs built-in Web browser, as also shown in that figure. Then complete building the application with the Application Wizard by clicking the Finish button.
To make the applications Web browser look less like a browser and more like online Help, use the Visual Basic menu editor to move the Web Browser menu item from the View menu to the Help menu and change its caption to Online Help. In addition, remove all the controls from the frmBrowser form except for the Web browser control, brwWebBrowser. Finally, take all code out of the frmBrowser form except for this code, which displays the starting page when the user opens the browser:
Public StartingAddress As String
Private Sub Form_Load()
Me.Show
If Len(StartingAddress) > 0 Then
brwWebBrowser.Navigate StartingAddress
End If
End Sub
And thats itnow when the user selects the Online Help item in the Help menu, the Web browser appears and connects to the Help page youve selected online, as shown in Figure 30.20. Congratulationsnow youre supporting online Help in your application. The code for this example is located in the FrmBrowser folder on this books accompanying CD-ROM.
Creating Online User RegistrationThe Testing Department has sent an email. Isnt there some way to keep track of your applications users? How about adding online registration to your application? Hmm, you think, how does that work? To let your applications users register their new purchase easily, you can add online registration to your program. When users click the Online Registration menu item in the Help menu, a dialog box appears asking them to enter their name and email address. When they do and click a button marked Register, the application connects to the Internet and sends the recorded information to you. Well see how this works in the next few topics in this chapter, where we use the FTP protocol to upload user registrations directly to an FTP site. This example, the onlinereg application, lets the user select a menu item, Register Online, in the Help menu, and displays an online registration form, Form2, as shown in Figure 30.21. When users enter their name and email address in the registration form and click the button labeled Register, the program sends the data in that form to an FTP server.
Well write the code for the registration form, Form2, now. When users enter their name and email address and click the Register button, we start by writing that information out to a temporary file, along with the name of the application the users are registering, as well as the time and date:
Private Sub Command1_Click()
Open "c:\temp.dat" For Output As #1
Print #1, "Registering SuperDuperDataCrunch" & vbCrLf
Print #1, "Name: " & Text1.Text & vbCrLf
Print #1, "email: " & Text2.Text & vbCrLf
Print #1, "Time: " & Format(Now)
Close #1
...
End Sub
This code stores the user information to the temp.dat file, like this: Registering SuperDuperDataCrunch Name: steve email: steve@steveco.com Time: 5/5/99 10:02:23 AM This is the data that we will upload to the FTP server in the next topic.
|
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |