More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

share code 18-Dec-2018 14:40

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

Code level: intermediate    Code area: Outlook Form Design Printer Friendly Version
Title: Change multipage control focus
Description: This CustomPropertyChange event handler for a custom form changes the visible page depending on the user's selection in a bound combo box. It also changes the control focus. See comments below for assumptions.
Date: 12-Dec-2007  21:22
Code level: intermediate
Code area: Outlook Form Design
Posted by: Sue Mosher
This message is displayed as VB.NET
 Sub Item_CustomPropertyChange(ByVal Name)
    If Name = "ComboField" Then 
        Set pg = Item.GetInspector.ModifiedFormPages("P.2")
        Set MultiPage1 = pg.Controls("MultiPage1")
        If Item.UserProperties("ComboField") = "red" Then 
            MultiPage1.Pages(0).Visible = False
            MultiPage1.Pages(1).Visible = True
            MultiPage1.Value = 1
            Set TextBox = MultiPage1.Pages(1).Controls("TextBox4")
            TextBox.SetFocus
        Else
            MultiPage1.Pages(1).Visible = False
            MultiPage1.Pages(0).Visible = True
            MultiPage1.Value = 0
            Set TextBox = MultiPage1.Pages(0).Controls("TextBox2")
            TextBox.SetFocus
        End If 
    End If 
End Sub
All 1comments
Page [ 1  
  12-Dec-2007  21:22   
This CustomPropertyChange event handler assumes the following:

    * Combo box is bound to a text property named ComboField with possible values "red" and "blue"
    * Custom page named P.2
    * Multipage control named MultiPage1 with two pages
    * On each page are two text boxes. TextBox2 is on page 1. TextBox4 is on page 2. (Each page also has another text box.)
Page [ 1