Bound Control Does Not Support Click EventID: Q181216
|
When creating a custom Outlook 98 form, if you bind controls such as the ListBox, CheckBox or OptionButton, the click event in Visual Basic Scripting Edition (VBScript) does not fire. When these controls are not bound, however, the click event is fired.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft Support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.asp
When designing Outlook forms, you typically bind a control to a field so
that the value in the control is preserved when the item is saved, posted,
or sent. To bind a control to a field, follow these steps:
Q180857 OL98: Supported Outlook Forms Control EventsThe following sample form demonstrates the click event with a bound and an unbound ListBox control:
Sub CommandButton1_Click()
' Sets ctl to the P.2 page of the form.
Set ctl = Item.GetInspector.ModifiedFormPages("P.2")
' Sets ListBox1 equal to the ListBox on the control.
Set ListBox1 = ctl.controls("ListBox1")
' Loop to populate Listbox with values.
For i = 0 To 3
ListBox1.AddItem cstr(i)
Next
End Sub
Sub ListBox1_click()
MsgBox "ListBox1 Click event fired."
End Sub
Sub ListBox2_click()
MsgBox "ListBox2 Click event fired."
End Sub
Sub Item_CustomPropertyChange(ByVal myPropName)
MsgBox "CustomPropertyChange event fired."
Select Case myPropName
Case "IsBound"
MsgBox "Code related to field changing goes here."
Case Else
MsgBox "<<Select Case Else>>"
End Select
End Sub
For more information about creating solutions with Microsoft Outlook 98,
please see the following articles in the Microsoft Knowledge Base:
Q180826 OL98: Resources for Custom Forms and Programming
Q182349 OL98: Questions About Custom Forms and Outlook Solutions
Additional query words: OutSol OutSol98
Keywords : kbdta kbdtacode OffVBS
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 23, 1999