Click here to Skip to main content
15,887,436 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Running project Pin
Dave Kreskowiak15-Jul-09 4:53
mveDave Kreskowiak15-Jul-09 4:53 
QuestionHandling Exceptions In Threads Pin
sohaib_a14-Jul-09 10:30
sohaib_a14-Jul-09 10:30 
AnswerRe: Handling Exceptions In Threads Pin
Luc Pattyn15-Jul-09 0:42
sitebuilderLuc Pattyn15-Jul-09 0:42 
GeneralRe: Handling Exceptions In Threads Pin
sohaib_a15-Jul-09 3:24
sohaib_a15-Jul-09 3:24 
GeneralRe: Handling Exceptions In Threads Pin
Luc Pattyn15-Jul-09 3:32
sitebuilderLuc Pattyn15-Jul-09 3:32 
AnswerRe: Handling Exceptions In Threads Pin
Gideon Engelberth15-Jul-09 3:16
Gideon Engelberth15-Jul-09 3:16 
GeneralRe: Handling Exceptions In Threads Pin
sohaib_a15-Jul-09 4:04
sohaib_a15-Jul-09 4:04 
QuestionTrouble with COM-Class for Outlook Pin
Sonhospa14-Jul-09 8:16
Sonhospa14-Jul-09 8:16 
Hello everybody,

maybe here's someone around who can help end the vicious circle I'm stuck in...

I'm writing a helper class for Outlook in VB2008 Express. The class checks if an Outlook MailItem is an inquiry (following a standardized pattern) or not, and exposes a few methods and properties to be used in VBA. Everything worked fine as long as I didn't try to structure the exposed information, i.e. as long as I held all the fields derived from a mail in the main class's properties.

Then I tried to structure the fields into different classes like "ProductInfo", "CustomerInfo" etc with their relevant methods/properties, additionally placing each of these sister classes into a property of the main class. As a result I could (after regasm, setting the reference in Outlook etc.) see all the classes and their methods/properties in the object catalog of Outlook VBA - and when writing the VBA code, everything seems to be ok and even IntelliSense works, including the hierarchy. So when I type 'Inquiry' and a dot, the nethods and properties of the main class show, typing 'Inquiry.Client." the properties of the client-class show.

And then? At runtime, the sister classes throw an error (object variable not set)...

'(VBA Code)
Public Sub Examine()
    Dim Item As MailItem
    
    For Each Item In Application.ActiveExplorer.Selection
        Dim Inq As MSInquiryNET.Inquiry
        Set Inq = New MSInquiryNET.Inquiry

           'Kontrolle ob Kunden-Daten in der Auswahl enthalten sind
            Set Inq.Item = Item
            Inq.CheckItem Item                 <--- WORKS (method of main class)
            MsgBox Inq.Medium                  <--- WORKS (property of main class)
            MsgBox Inq.Client.FirstName & " " & Inq.Client.FamilyName       <---- ERROR

        Set Inq = Nothing
    Next
    
End Sub
Can anyone tell me what I would have to change in order to avoid that error?

Here's my .NET code (abbreviated):
<Runtime.InteropServices.ComVisible(True)> _
<Microsoft.VisualBasic.ComClass()> _
Public Class Inquiry

    Public Function CheckItem(ByVal oMsg As Outlook.MailItem) As Boolean
        Me.Medium = GetMedia(oMsg)
        Me.Item = oMsg

        Try
            Select Case Me.Medium
                Case "PaperAds"
                    CollectScoutDataHTML()
                Case Else
                    MessageBox.Show(String.Format("Die Abfrage für '{0}' ist noch nicht automatisiert möglich.", Me.Medium), "Abbruch", MessageBoxButtons.OK)
                    Return False
            End Select
            Return True

        Catch ex As System.Exception
            MsgBox(String.Format("Fehler in der Routine '{0}'", "CheckItem"))
        End Try

    End Function

' main class' properties
    Private _Client As Client
    Public Property Client() As Client
        Get
            Return _Client
        End Get
        Set(ByVal value As Client)
            _Client = value
        End Set
    End Property

    Private _Item As MailItem
    Public Property Item() As MailItem
        Get
            Return _Item
        End Get
        Set(ByVal obj As MailItem)
            _Item = obj
        End Set
    End Property

End class

<Runtime.InteropServices.ComVisible(True)> _
<Microsoft.VisualBasic.ComClass()> _
Public Class Client

    Private _FirstName As String
    Public Property FirstName() As String
        Get
            Return _FirstName
        End Get
        Set(ByVal value As String)
            _FirstName = value
        End Set
    End Property

    Private _FamilyName As String
    Public Property FamilyName() As String
        Get
            Return _FamilyName
        End Get
        Set(ByVal value As String)
            _FamilyName = value
        End Set
    End Property

End class
I assume that I have to set an object for the sister classes somewhere in the .NET code, but by now my attempts failed. Where and how would I declare and expose such an object properly?

Thank you for advice,
Michael
AnswerRe: Trouble with COM-Class for Outlook Pin
Sonhospa14-Jul-09 9:06
Sonhospa14-Jul-09 9:06 
QuestionHelp Creating Exe File[modified] Pin
Kaushal Arora14-Jul-09 6:52
Kaushal Arora14-Jul-09 6:52 
AnswerRe: Help Pin
Steven J Jowett14-Jul-09 7:47
Steven J Jowett14-Jul-09 7:47 
QuestionAdd tables to existing SQL database Pin
Nielvh14-Jul-09 1:38
Nielvh14-Jul-09 1:38 
AnswerRe: Add tables to existing SQL database Pin
helelark12314-Jul-09 1:47
helelark12314-Jul-09 1:47 
GeneralRe: Add tables to existing SQL database Pin
Nielvh14-Jul-09 1:55
Nielvh14-Jul-09 1:55 
GeneralRe: Add tables to existing SQL database Pin
helelark12314-Jul-09 2:09
helelark12314-Jul-09 2:09 
GeneralRe: Add tables to existing SQL database Pin
Nielvh14-Jul-09 2:17
Nielvh14-Jul-09 2:17 
Questionrun access query for crystal report Pin
KIDYA13-Jul-09 23:26
KIDYA13-Jul-09 23:26 
AnswerRe: run access query for crystal report Pin
helelark12313-Jul-09 23:37
helelark12313-Jul-09 23:37 
GeneralRe: run access query for crystal report Pin
KIDYA14-Jul-09 0:39
KIDYA14-Jul-09 0:39 
QuestionData Conversion Error at RecordSet.MoveNext VB6 Pin
she-Developer13-Jul-09 22:19
she-Developer13-Jul-09 22:19 
AnswerRe: Data Conversion Error at RecordSet.MoveNext VB6 Pin
helelark12313-Jul-09 22:27
helelark12313-Jul-09 22:27 
QuestionWindows Popup Watcher Pin
jeipiyaku13-Jul-09 22:09
jeipiyaku13-Jul-09 22:09 
AnswerRe: Windows Popup Watcher Pin
jeipiyaku13-Jul-09 22:16
jeipiyaku13-Jul-09 22:16 
GeneralRe: Windows Popup Watcher Pin
helelark12313-Jul-09 22:23
helelark12313-Jul-09 22:23 
GeneralRe: Windows Popup Watcher Pin
jeipiyaku13-Jul-09 22:37
jeipiyaku13-Jul-09 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.