![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
hi!
1.is it possible to place .NET custom control on custom form(message/ contact) in outlook 2003 & 2007?(as it is not listed in additional controls when designing form,THOUGH it is registered using regsvr32) What extra steps r required in order to list it in additional controls? 2.How to access Custom control built in vb placed on form region in outlook 2007 from VSTO addIn?I was able to access OLk ctrls on Form region in VSTO addin.I want to access custom controls custom properties(getdata/setdata) in VSTO Addin?how to accomplish this using vb.net THanks! |
Ads |
#2
|
|||
|
|||
![]()
You can't add a .NET custom control to an Outlook form. All controls on
Outlook forms are either members of the Forms 2.0 library or are custom ActiveX controls. You also shouldn't use the OLK* controls on a custom form other than in a form region, they aren't tested for that and will cause weird problems. It doesn't matter whether or not you're using VSTO, you access any control on a form the same way whether or not it's a custom control. item.ModifiedFormPages("myPage").Controls.Item("my Control"). -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "sd" wrote in message ups.com... hi! 1.is it possible to place .NET custom control on custom form(message/ contact) in outlook 2003 & 2007?(as it is not listed in additional controls when designing form,THOUGH it is registered using regsvr32) What extra steps r required in order to list it in additional controls? 2.How to access Custom control built in vb placed on form region in outlook 2007 from VSTO addIn?I was able to access OLk ctrls on Form region in VSTO addin.I want to access custom controls custom properties(getdata/setdata) in VSTO Addin?how to accomplish this using vb.net THanks! |
#3
|
|||
|
|||
![]()
Thanks!
I've one more question-I've designed form region for my custom form & hook up my addin to this form region.(I referred TravellAgencyAddInVB_VSTO) now the form region adjoined to my custom form is shown when I compose.But I want to access the ctrl values on this form region in ItemSend event.How to get this? In TravellAgencyAddInVB_VSTO addin they r accessed initially when displaying the region(In MailPreviewFormRegionWrapper class)please give some sample code snippet or any link that can be helpful.Thanks again On Oct 8, 8:07 pm, "Ken Slovak - [MVP - Outlook]" wrote: You can't add a .NETcustomcontrol to anOutlookform. AllcontrolsonOutlookforms are either members of the Forms 2.0 library or arecustom ActiveXcontrols. You also shouldn't use the OLK*controlson acustomform other than in a form region, they aren't tested for that and will cause weird problems. It doesn't matter whether or not you're using VSTO, you access any control on a form the same way whether or not it's acustomcontrol. item.ModifiedFormPages("myPage").Controls.Item("my Control"). -- Ken Slovak [MVP -Outlook]http://www.slovaktech.com Author: Professional ProgrammingOutlook2007 Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm "sd" wrote in message ups.com... hi! 1.is it possible to place .NETcustomcontrol oncustomform(message/ contact) inoutlook2003 & 2007?(as it is not listed in additional controlswhen designing form,THOUGH it is registered using regsvr32) What extra steps r required in order to list it in additional controls? 2.How to accessCustomcontrol built in vb placed on form region in outlook2007 from VSTO addIn?I was able to access OLk ctrls on Form region in VSTO addin.I want to accesscustomcontrolscustom properties(getdata/setdata) in VSTO Addin?how to accomplish this using vb.net THanks!- Hide quoted text - - Show quoted text - |
#4
|
|||
|
|||
![]()
I don't have any code for that, but if you store a reference to your form
region for later you should be able to access it again in the send event handler. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "sd" wrote in message oups.com... Thanks! I've one more question-I've designed form region for my custom form & hook up my addin to this form region.(I referred TravellAgencyAddInVB_VSTO) now the form region adjoined to my custom form is shown when I compose.But I want to access the ctrl values on this form region in ItemSend event.How to get this? In TravellAgencyAddInVB_VSTO addin they r accessed initially when displaying the region(In MailPreviewFormRegionWrapper class)please give some sample code snippet or any link that can be helpful.Thanks again |
#5
|
|||
|
|||
![]()
hi!
I declared variables representing form region ctrls as public in MailPreviewFormRegionWrapper class & obtained values of these ctrls in HookUp class through readonly properties.Hence was able to access values in application.ItemSend event.But if this will have any adverse effect? Thanks again !! On Oct 9, 8:50 pm, "Ken Slovak - [MVP - Outlook]" wrote: I don't have any code for that, but if you store a reference to your form region for later you should be able to access it again in the send event handler. -- Ken Slovak [MVP -Outlook]http://www.slovaktech.com Author: Professional ProgrammingOutlook2007 Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm "sd" wrote in message oups.com... Thanks! I've one more question-I've designed form region for mycustomform & hook up my addin to this form region.(I referred TravellAgencyAddInVB_VSTO) now the form region adjoined to mycustomform is shown when I compose.But I want to access the ctrl values on this form region in ItemSend event.How to get this? In TravellAgencyAddInVB_VSTO addin they r accessed initially when displaying the region(In MailPreviewFormRegionWrapper class)please give some sample code snippet or any link that can be helpful.Thanks again- Hide quoted text - - Show quoted text - |
#6
|
|||
|
|||
![]()
As long as you release your objects per best practice I don't see why there
should be any bad effects. Are you seeing any? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "sd" wrote in message ups.com... hi! I declared variables representing form region ctrls as public in MailPreviewFormRegionWrapper class & obtained values of these ctrls in HookUp class through readonly properties.Hence was able to access values in application.ItemSend event.But if this will have any adverse effect? Thanks again !! |
#7
|
|||
|
|||
![]()
hello
I still have problem,when I open multiple instances of Mail Compose say 1,2, 3 & then send mail 2 then I get the values of form region ctrl of mail 3 .I can get proper values in FormRegion_Close event but that is fired after Application_ItemSend. What's wrong with below code ?Do I've to use userproperties? Thanks! Class MailPreviewFormRegionWrapper 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 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) ' Initalize region controls InitializeControls() ' Find the contact and load those values LoadValues() End Sub Public cmbMatter As Outlook.OlkComboBox Private Sub InitializeControls() ' Turn off the scroll bars on this form UserForm.ScrollBars = Microsoft.Vbe.Interop.Forms.fmScrollBars.fmScrollB arsNone Try cmbMatter = DirectCast(UserForm.Controls.Item("cmbMatter"), Outlook.OlkComboBox) cmbMatter.Text = "" Catch ex As Exception Debug.WriteLine("An error occured while hooking up Form Region controls: " & ex.Message) End Try End Sub Private Sub FormRegion_Close() Handles FormRegion.Close If Not (m_Items Is Nothing) Then m_Items = Nothing End If If Not cmbMatter Is Nothing Then cmbMatter = Nothing RaiseClose() End Sub Private Sub LoadContactProperties() 'fill cmbMatter with values End Sub End Class Public Class FormRegionHookupVB Implements Outlook.FormRegionStartup Private Const NOTE_REGION As String = "OutlookLawComposeMailPreview" Private ComposecmbMatter As Outlook.OlkComboBox Private Application As Outlook.Application Private m_KnownRegions As List(Of OutlookLawVB_VSTO.BaseFormRegionWrapper) Public Sub New(ByVal outlookApplication As Outlook.Application) Application = outlookApplication m_KnownRegions = New List(Of OutlookLawVB_VSTO.BaseFormRegionWrapper) End Sub Function GetFormRegionStorage(ByVal FormRegionName As String, ByVal Item As Object, ByVal LCID As Integer, ByVal FormRegionMode As Outlook.OlFormRegionMode, ByVal FormRegionSize As Outlook.OlFormRegionSize) As Object Implements Outlook.FormRegionStartup.GetFormRegionStorage Try Select Case FormRegionName Case NOTE_REGION Dim myItem As OutlookItem = New OutlookItem(Item) Dim mail As Outlook.MailItem = CType(myItem.InnerObject, Outlook.MailItem) Return My.Resources.ComposeMail Case Else Return Nothing End Select Catch ex As Exception Debug.WriteLine(ex.Message) Return Nothing End Try Sub BeforeFormRegionShow(ByVal FormRegion As Outlook.FormRegion) Implements Outlook.FormRegionStartup.BeforeFormRegionShow Try Dim wrapper As OutlookLawVB_VSTO.MailPreviewFormRegionWrapper = Nothing Select Case FormRegion.InternalName Case NOTE_REGION wrapper = New OutlookLawVB_VSTO.MailPreviewFormRegionWrapper(For mRegion, Application) ComposecmbMatter = wrapper.cmbMatter End Select If Not (wrapper Is Nothing) Then m_KnownRegions.Add(wrapper) End If Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub Public Function GetFormRegionManifest(ByVal FormRegionName As String, ByVal LCID As Integer) As Object Implements Microsoft.Office.Interop.Outlook._FormRegionStartu p.GetFormRegionManifest Select Case FormRegionName Case NOTE_REGION Return My.Resources.ComposeMailManifest Case Else Return Nothing End Select End Function Public ReadOnly Property cmbMatter() As String Get cmbMatter = ComposecmbMatter.Text End Get End Property End Class public class ThisAddIn Private ObjFormRegion As OutlookLawVB_VSTO.FormRegionHookupVB Protected Overrides Function RequestService(ByVal serviceGuid As Guid) _ As Object If serviceGuid = _ GetType(Microsoft.Office.Interop.Outlook.FormRegio nStartup).GUID Then ObjFormRegion = New OutlookLawVB_VSTO.FormRegionHookupVB(Me.Applicatio n) Return ObjFormRegion End If Return MyBase.RequestService(serviceGuid) End Function Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) Handles Application.ItemSend Dim strErrMsg As String, strXHeader As String Try AddTrace("Entering Application_ItemSend") strXHeader = ObjFormRegion.cmbMatter Catch ex As System.Exception strErrMsg = "Error in Application_ItemSend" & "-" & ex.Message AddTrace(strErrMsg) errAddTrace(strErrMsg) Finally AddTrace("Exiting Application_ItemSend") End Try End Sub End Class |
#8
|
|||
|
|||
![]()
I'm not going to analyze all that code, but I'd guess that you should use
bound fields from your form region to user properties so the values are available at any time. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "sd" wrote in message ps.com... hello I still have problem,when I open multiple instances of Mail Compose say 1,2, 3 & then send mail 2 then I get the values of form region ctrl of mail 3 .I can get proper values in FormRegion_Close event but that is fired after Application_ItemSend. What's wrong with below code ?Do I've to use userproperties? Thanks! Class MailPreviewFormRegionWrapper 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 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) ' Initalize region controls InitializeControls() ' Find the contact and load those values LoadValues() End Sub Public cmbMatter As Outlook.OlkComboBox Private Sub InitializeControls() ' Turn off the scroll bars on this form UserForm.ScrollBars = Microsoft.Vbe.Interop.Forms.fmScrollBars.fmScrollB arsNone Try cmbMatter = DirectCast(UserForm.Controls.Item("cmbMatter"), Outlook.OlkComboBox) cmbMatter.Text = "" Catch ex As Exception Debug.WriteLine("An error occured while hooking up Form Region controls: " & ex.Message) End Try End Sub Private Sub FormRegion_Close() Handles FormRegion.Close If Not (m_Items Is Nothing) Then m_Items = Nothing End If If Not cmbMatter Is Nothing Then cmbMatter = Nothing RaiseClose() End Sub Private Sub LoadContactProperties() 'fill cmbMatter with values End Sub End Class Public Class FormRegionHookupVB Implements Outlook.FormRegionStartup Private Const NOTE_REGION As String = "OutlookLawComposeMailPreview" Private ComposecmbMatter As Outlook.OlkComboBox Private Application As Outlook.Application Private m_KnownRegions As List(Of OutlookLawVB_VSTO.BaseFormRegionWrapper) Public Sub New(ByVal outlookApplication As Outlook.Application) Application = outlookApplication m_KnownRegions = New List(Of OutlookLawVB_VSTO.BaseFormRegionWrapper) End Sub Function GetFormRegionStorage(ByVal FormRegionName As String, ByVal Item As Object, ByVal LCID As Integer, ByVal FormRegionMode As Outlook.OlFormRegionMode, ByVal FormRegionSize As Outlook.OlFormRegionSize) As Object Implements Outlook.FormRegionStartup.GetFormRegionStorage Try Select Case FormRegionName Case NOTE_REGION Dim myItem As OutlookItem = New OutlookItem(Item) Dim mail As Outlook.MailItem = CType(myItem.InnerObject, Outlook.MailItem) Return My.Resources.ComposeMail Case Else Return Nothing End Select Catch ex As Exception Debug.WriteLine(ex.Message) Return Nothing End Try Sub BeforeFormRegionShow(ByVal FormRegion As Outlook.FormRegion) Implements Outlook.FormRegionStartup.BeforeFormRegionShow Try Dim wrapper As OutlookLawVB_VSTO.MailPreviewFormRegionWrapper = Nothing Select Case FormRegion.InternalName Case NOTE_REGION wrapper = New OutlookLawVB_VSTO.MailPreviewFormRegionWrapper(For mRegion, Application) ComposecmbMatter = wrapper.cmbMatter End Select If Not (wrapper Is Nothing) Then m_KnownRegions.Add(wrapper) End If Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub Public Function GetFormRegionManifest(ByVal FormRegionName As String, ByVal LCID As Integer) As Object Implements Microsoft.Office.Interop.Outlook._FormRegionStartu p.GetFormRegionManifest Select Case FormRegionName Case NOTE_REGION Return My.Resources.ComposeMailManifest Case Else Return Nothing End Select End Function Public ReadOnly Property cmbMatter() As String Get cmbMatter = ComposecmbMatter.Text End Get End Property End Class public class ThisAddIn Private ObjFormRegion As OutlookLawVB_VSTO.FormRegionHookupVB Protected Overrides Function RequestService(ByVal serviceGuid As Guid) _ As Object If serviceGuid = _ GetType(Microsoft.Office.Interop.Outlook.FormRegio nStartup).GUID Then ObjFormRegion = New OutlookLawVB_VSTO.FormRegionHookupVB(Me.Applicatio n) Return ObjFormRegion End If Return MyBase.RequestService(serviceGuid) End Function Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) Handles Application.ItemSend Dim strErrMsg As String, strXHeader As String Try AddTrace("Entering Application_ItemSend") strXHeader = ObjFormRegion.cmbMatter Catch ex As System.Exception strErrMsg = "Error in Application_ItemSend" & "-" & ex.Message AddTrace(strErrMsg) errAddTrace(strErrMsg) Finally AddTrace("Exiting Application_ItemSend") End Try End Sub End Class |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add Custom Control to Outlook form | [email protected] | Add-ins for Outlook | 2 | May 16th 07 04:37 PM |
How to access a custom control in an outlook form from my VBA code? | MeAgin | Outlook and VBA | 1 | January 23rd 07 05:39 AM |
Control events in Outlook 2007 custom forms/regions | nalpakj | Outlook - Using Forms | 1 | January 10th 07 02:17 PM |
Control events in Outlook 2007 custom forms/regions | nalpakj | Outlook - Using Forms | 1 | January 9th 07 11:08 PM |
How to handling Custom Form Control Event in VB Com Add-In? | Raphaël ZHOU \(Jadiam\) | Outlook - Using Forms | 1 | January 11th 06 07:31 AM |