0
메일 항목을 열 때 FormRegion에 추가 한 텍스트 상자를 넣으려고합니다. 텍스트 상자가 항목에 있지만 텍스트 상자에 카테고리를 할당하려고하면 Formregion1이 null이므로 null 참조 예외가 발생합니다. NewInspector
이벤트가 발생할 때NewInspector의 FormRegion null
Imports Microsoft.Office.Interop.Outlook
Public Class ThisAddIn
Private WithEvents inspectors As Outlook.Inspectors
Private Sub ThisAddIn_Startup() Handles Me.Startup
inspectors = Me.Application.Inspectors
End Sub
Private Sub inspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector
Dim mailItem As Outlook.MailItem = TryCast(Inspector.CurrentItem, Outlook.MailItem)
Dim mCat As String
Dim formRegions As WindowFormRegionCollection = Globals.FormRegions(Inspector)
mCat = mailItem.Categories
formRegions.FormRegion1.TextBox1.Text = mCat
End Sub
Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
End Sub
End Class
양식 영역 대신 작업 창을 사용하는 것이 더 나은 선택입니까? –