Preview Pane refresh with form region

S

shubhangi

hello
I've adjoined form region to preview pane for message.I've also adjoined
form region to read pane for message.In read pane form region ,one cmd
button
(save) is placed along with 2 comboboxes.When user modifies combobox
contents
& clicks save button & close read pane I've to refresh the preview pane with
modified user supplied values.Code is

Private Sub FormRegion_Close() Handles FormRegion.Close

If Not (m_Items Is Nothing) Then
m_Items = Nothing
End If

If Not CtlRegion Is Nothing Then CtlRegion = Nothing 'CtlRegion is AX ctrl
on form region with 2 'comboboxes & save cmd bttn

'reflect changes in read pane to preview pane

m_Application.ActiveExplorer.ShowPane(Outlook.OlPane.olPreview, False) 'line
1
m_Application.ActiveExplorer.ShowPane(Outlook.OlPane.olPreview, True) 'line
2
RaiseClose()

End Sub

This refreshes preview pane form region but preview pane form region shows
up open (-) but minimized i.e. it appears at the bottom not showing all the
controls on form region.I need to click (-) & then (+) to display it
properly.
When I comment line 1 & line 2,Form region is shown properly with all
controls shown in preview pane form region.

I need to refresh preview pane form region as well as show form region
properly.
Thanks
 
K

Ken Slovak - [MVP - Outlook]

You can try the FormRegion.Select method instead of toggling the visibility
of the preview pane (aka reading pane). Select will expand the form region
if it's not already expanded.

BTW, it's not at all a good idea to allow users to change/edit contents of
any textbox or control that contains a textbox type section such as a
combobox. If the user hits the delete key the selected item (the one shown
in preview) will be deleted, not the contents of the control the focus is
in. The recommendation in that case is to lock the controls so they can't be
changed and to force the user to open the item to make changes in the
control values.
 
S

shubhangi

Thanks Ken
But I'm very much new to this form region.Where to invoke
formregion.select.Whenever I use
FormRegion.Select ,it gives me error "Not implemented"
I've below code

MustInherit Class BaseFormRegionWrapper
Implements IDisposable

Protected WithEvents FormRegion As Outlook.FormRegion
Public Event Close As EventHandler
Protected Sub RaiseClose()
RaiseEvent Close(Me, EventArgs.Empty)
End Sub
'IDisposable Members also
End Class

Class ReadMailFormRegionWrapper
Inherits BaseFormRegionWrapper

Shadows WithEvents FormRegion As Outlook.FormRegion
Shadows WithEvents UserForm As Forms.UserForm
Public Sub New(ByVal region As Outlook.FormRegion, ByVal application As
Outlook.Application)
m_Application = application
Me.Item = region.Item
Me.FormRegion = region
Me.UserForm = CType(FormRegion.Form, Forms.UserForm)
End Sub
Private Sub FormRegion_Close() Handles FormRegion.Close
RaiseClose()
End Sub
Public Class FormRegionHookupVB
Implements Outlook.FormRegionStartup

Sub BeforeFormRegionShow(ByVal FormRegion As Outlook.FormRegion) Implements

Outlook.FormRegionStartup.BeforeFormRegionShow

Dim wrapper As BaseFormRegionWrapper = Nothing
Select Case FormRegion.InternalName
Case NOTE_PREVIEW_PANE_REGION
wrapper = New PreviewPaneMailFormRegionWrapper(FormRegion, Application)
AddHandler wrapper.Close, AddressOf wrapper_Close

End Select
End Sub
End Class
 
K

Ken Slovak - [MVP - Outlook]

You would call it when you have a valid FormRegion object and when you want
to select the form region.
 
S

shubhangi

I tried to switch folders in order to refresh preview pane when changes r
made in reading pane,
that worked
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top