A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

save prompt and form region



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 18th 08, 10:10 AM posted to microsoft.public.outlook.program_addins
sd[_2_]
external usenet poster
 
Posts: 69
Default save prompt and form region

Hello
I've VSTO SE Addin for OL2007.I've adjoined form region to standard
Appointment form.I've placed AX Ctrl built using vb6 on that form
region.It prompts me for save even though I didn't make any change.The
AX Ctrl contains 2 combos.In combo change & click I'm calling
AddModifyUserProp which adds or modifies userprop value.B'coz of
addition/Modification of userprop values it may be prompting for
save,but once userprop gets added it should not prompt for save.but I
always get save prompt whenever I open existing item ,changes combo
contents & for save prompt I says no ,reopens same item & closes the
item without any change.Now though no change,it prompts me for
save.Below is the code-
AX Ctrl-
Public Sub AddModifyUserProp(ByVal PropName As String, ByVal PropValue
As String)
Set ObjAppointmentItem = ActiveInspector.CurrentItem
If Not ObjAppointmentItem Is Nothing Then
Dim userProperty As Outlook.userProperty
Set userProperty =
ObjAppointmentItem.UserProperties.Find(PropName, True)
If userProperty Is Nothing Then
Set userProperty =
ObjAppointmentItem.UserProperties.Add(PropName, olText, True)
End If
userProperty.Value = PropValue
Set ObjAppointmentItem = Nothing
End If
End Sub

ComposeAppoinmentFormRegionWrapper.vb -
Class ComposeAppoinmentFormRegionWrapper
Inherits BaseFormRegionWrapper
Private m_Application As Outlook.Application
Private WithEvents m_Items As Outlook.Items
Shadows WithEvents FormRegion As Outlook.FormRegion
Shadows WithEvents UserForm As Forms.UserForm
Shadows WithEvents Item As Outlook.AppointmentItem
Private WithEvents CtlRegion As MyAXCtrl
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)
InitializeControls()
End Sub
Private Sub InitializeControls()
CtlRegion =
DirectCast(UserForm.Controls.Item("MyAXCtrl1"),MyA XCtrl)
DisplayUserProperties 'assigns values to combos on
AXCtrl ,In AXCtrl while assigning values to
combo,AddModifyUserProperties()
'is avoided initially by a flag ,which is reset so after displaying
values to combo ,AddModifyUserProperties() gets invoked if combo is
changed
End Sub
Private Sub item_Write(ByRef cancel As Boolean) Handles Item.Write
'retrieves AXCtrl combo values & writes them to database.
End sub
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
If Not UserForm Is Nothing Then UserForm = Nothing
If Not FormRegion Is Nothing Then FormRegion = Nothing
If Not m_Application Is Nothing Then m_Application =
Nothing
RaiseClose()
End Sub

BaseFormRegionWrapper.vb
MustInherit Class BaseFormRegionWrapper
Implements IDisposable
Private Disposed As Boolean = False
Protected Item As Object
Protected WithEvents FormRegion As Outlook.FormRegion
Protected WithEvents UserForm As Forms.UserForm
Public Event Close As EventHandler
Protected Sub RaiseClose()
RaiseEvent Close(Me, EventArgs.Empty)
End Sub
Protected Overrides Sub Finalize()
Me.Dispose(False)
End Sub
Public Overloads Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Protected Overloads Sub Dispose(ByVal disposeManagedResources As
Boolean)
If Not Me.Disposed Then
If disposeManagedResources Then
Item = Nothing
End If
If Not (FormRegion Is Nothing) Then
Marshal.ReleaseComObject(FormRegion)
FormRegion = Nothing
End If
If Not (UserForm Is Nothing) Then
Marshal.ReleaseComObject(UserForm)
UserForm = Nothing
End If
Disposed = True
End If
End Sub

Thanks
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Region below Send Button Vela Add-ins for Outlook 4 January 25th 08 09:15 PM
Keypress and OLKCombobox on form region shubhangi Outlook and VBA 1 October 23rd 07 05:14 PM
form region not shown properly sd[_2_] Outlook and VBA 4 October 17th 07 10:09 PM
'adjoining' form region Alan Outlook - Using Forms 1 May 29th 07 06:42 PM
Communicate with a Form Region Vbasiccode Outlook - Using Forms 5 May 9th 07 11:51 PM


All times are GMT +1. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.