Working with Forms Pages: The Pages Collection

[Previous] [Next]

Even though the Page object is not an official part of the Outlook object library, most developers use the methods and properties of the Page object in their applications. The Page object, which comprises the objects of the ModifiedFormPages collection, is actually contained in the Microsoft Forms 2.0 object library.

The following section lists the most commonly used properties for the Page object. Note that the Page object actually corresponds to the area on a form that falls below the tab displaying the name of the page. You need to know this, especially if you want to add a caption to the page—don't assume that this caption appears as the tab name! Instead, the caption appears directly on the form page and not on the tab. For a full list of the properties and methods, use an object browser to view the Page object, or look up the Page object in the Fm20.hlp file on the companion CD.

Page Object Properties

The following sections describe the properties of the Page object.

ActiveControl Property

The ActiveControl property returns the control on the page that currently has the focus. You can use this property to manipulate the active control on a form. The following code uses the ActiveControl property to change the caption on the control that currently has the focus in the form:

     Sub CommandButton1_Click         set oPages = Item.GetInspector.ModifiedFormPages         set oP2 = oPages("P.2")         msgbox oP2.ActiveControl.Name         oP2.ActiveControl.Caption = "This is the active control"     End Sub 

Enabled Property

The Enabled property allows you to swiftly disable all the controls on a form without having to create a For or While loop. All controls on the form will immediately enter into their disabled state once you set this property to False. The following code shows you how to take advantage of the Enabled property for a page:

     Sub CommandButton1_Click         set oPages = Item.GetInspector.ModifiedFormPages         set oP2 = oPages("P.2")         oP2.Enabled = False     End Sub

Picture Property

The Picture property allows you to change the background of the form. For example, you can change the entire background of the form to yellow or to a bitmap image if the user tries to submit the form without filling in all the required fields. The following code shows you how to use the Picture property in your application. Note the use of the LoadPicture method to load the picture. You can also use the LoadPicture method to load picture for individual controls.

     Sub CommandButton1_Click         set oPages = Item.GetInspector.ModifiedFormPages         set oP2 = oPages("P.2")         oP2.Picture = LoadPicture("C:\winnt\winnt256.bmp")     End Sub 



Programming Microsoft Outlook and Microsoft Exchange
Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)
ISBN: 0735610193
EAN: 2147483647
Year: 2000
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net