Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Adding Tables To DHTML Pages

One popular HTML element is the table. Tables can present data in tabular form, but savvy HTML programmers use them for much more. They use tables to format the elements in a Web page, placing those elements at locations they want by inserting them into a table—for example, you can add sidebars and format image placement with hidden tables. Although the dynamic HTML position attribute helps you place HTML elements where you want them, that attribute is not yet supported by all browsers.

To add a table to a DHTML page, you use the Table Operation drop-down box that you see in Figure 21.8. To insert a table, use the Insert Table entry in that drop-down box. When you do, the Page Designer adds a 2×2 table to the page. To add a row, select the Insert Row entry in the Table Operation drop-down box; to add a column, select the Insert Column entry.


Figure 21.8  Adding a table to a DHTML page.

As an example, we’ve added a 3×3 table to our Web page, as shown in Figure 21.8. To add text to each cell in the table, just position the insertion point there with the mouse and type the text you want.

Adding Hyperlinks To DHTML Pages

To add a hyperlink to a DHTML page, you use the Hyperlink tool in the DHTML Page Designer’s toolbox, which is the sixth tool down on the right in Figure 21.9. When you double-click the Hyperlink tool, a hyperlink object is added to the Web page with the caption Hyperlink1. Move that hyperlink to the location you want in the Web page, and change its caption to the text you want simply by changing the text in the hyperlink object directly (just click the hyperlink and type the text as you would in any word processor).


Figure 21.9  Adding a hyperlink to a Web page.

To set the hyperlink’s target URL, right-click the hyperlink and select the Properties item in the menu that opens. Next, place the target URL in the box labeled link, as shown in Figure 21.10.


Figure 21.10  Setting hyperlink properties.


TIP:  Note that you can also set a frame as the target of a hyperlink, which means that the target URL will be loaded into the specified frame. See Figure 21.10.

Here’s the code that the Page Designer adds to our Web page for our hyperlink:

<P>Here’s a hyperlink:
<A href="http://www.microsoft.com"
id=Hyperlink11 name=Hyperlink1>Microsoft
</A>
</P>

That’s it—to run the Web page, select the DHTMLProject Properties item in the Project menu, clicking the Debugging tab in the Properties pages that open. Make sure the Start Component option button is clicked and the start component is set to DHTMLPage1, then click on OK. Now select the Start item in the Run menu to open the Web page, as shown in Figure 21.11. As you can see, our new Web page is a success.


Figure 21.11  Our completed Web page.

Using MAPI Controls To Support Email

The testing department is calling again. How about adding email capabilities to your new program, SuperDuperDataCrunch? Why? you ask. If nothing else, they say, it can provide an automatic way for the user to register their new program. Hmm, you think—how do you add email to a program?

You use the MAPI (Messaging Applications Programming Interface) controls that come with Visual Basic.


WARNING!  Note that if you want to run a program that uses the MAPI controls, make sure that you have the 32-bit MAPI DLLs installed properly or you may not be able to perform simple MAPI functions such as SignOn. For example, on Windows 95, you must install Mail during the operating system setup or install it separately from the control panel to correctly use MAPI functions or MAPI custom controls from Visual Basic. The Visual Basic email support is based on the Microsoft Exchange utility that’s installed with Windows (and usually appears on the Windows desktop as the Inbox icon). If you want to use the MAPI controls, make sure your desktop Inbox is configured to send and receive email.

There are two MAPI controls, the MAPISession control and the MAPIMessages control. To add these controls to a program, follow these steps:

1.  Select the Project|Components menu item.
2.  Click the Controls tab in the Components dialog box that opens.
3.  Select the entry labeled Microsoft MAPI Controls, and click on OK to close the Components dialog box.
4.  Step 3 adds both the MAPISession control and the MAPIMessages control to the Visual Basic toolbox. You’ll need to add one of each of those controls to your program to use email.

You use the MAPISession control to open a new MAPI session, which is the first step to sending or receiving email, and the MAPIMessages control lets you compose, send, and examine downloaded messages.

The MAPIMessages control is the primary control you use in your code (the MAPISession control is only used to connect to the Inbox). To work with the MAPIMessages control, you keep track of two buffers, the read buffer and the compose buffer.

The read buffer is made up of a set of messages read from a user’s Inbox. The MsgIndex property is used to address individual messages within this set, starting with a value of 0 for the first message and incrementing by one for each message. You get the actual email’s text from the control’s MsgNoteText property.

Messages can be created or edited in the compose buffer. The compose buffer is automatically set as the active buffer when the MsgIndex property is set to -1.

The MAPIMessages control’s message set is built with the Fetch method. This set includes all messages of type specified by the FetchMsgType property and is sorted as indicated by the FetchSorted property. (Previously read messages can be included or left out of the message set with the FetchUnreadOnly property.) Messages in the read buffer can’t be altered by the user but can be copied to the compose buffer for alteration using the Copy method.

You can see an overview of the MAPIMessages control’s methods in Table 21.1, and its properties appear in Table 21.2. We’ll put this control to work in the following few topics.


Previous Table of Contents Next


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.