'Application' is not a member of 'WindowsApplication1.Form1'

Status
Niet open voor verdere reacties.

Rickymundo

Gebruiker
Lid geworden
20 aug 2012
Berichten
30
Hi all,

Ik probeer een agenda verzoek te creëren. Dus een popup maar dat loopt nog niet helemaal lekker, althans, 1 error. Waarschijnlijk heel makkelijk, maar ik kom er niet uit.
Wat gaat er mis:

Code:
Imports Microsoft.Office.Interop

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 Dim newAppointment As Outlook.AppointmentItem = Me.Application.CreateItem _
                (Outlook.OlItemType.olAppointmentItem)
        Try
            With newAppointment
                .Start = Date.Now.AddHours(2)
                .End = Date.Now.AddHours(3)
                .Location = "ConferenceRoom #2345"
                .Body = _
                    "We will discuss progress on the group project."
                .Subject = "Group Project"
                .AllDayEvent = False
                .Recipients.Add("Roger Harui")
                Dim sentTo As Outlook.Recipients = .Recipients
                Dim sentInvite As Outlook.Recipient
                sentInvite = sentTo.Add("Holly Holt")
                sentInvite.Type = Outlook.OlMeetingRecipientType.olRequired
                sentInvite = sentTo.Add("David Junca")
                sentInvite.Type = Outlook.OlMeetingRecipientType.olOptional
                sentTo.ResolveAll()
                .Save()
                .Display(True)
            End With
        Catch ex As Exception
            MsgBox("The following error occurred: " & _
                ex.Message)
        End Try

    End Sub


End Class
 
Ja, het enige wat mis gaat is dat er een blaauw golfje onder Me.application komt en ik weet niet hoe ik hier van af kom?!
 
Als je op het form waar je op dat moment bent (waar je de code uitvoert) hoef je geen me. te gebruiken.


Net als bij bijv. een label.

  • op het uitgevoerde form is het = label1.text = "test"
  • Op een ander form is het = form2.label1.text = "test"
  • fout = me.label1.text = "test"
 
Als ik ME weghaal en dus verder ga als:

Code:
        Dim newAppointment As Outlook.AppointmentItem = Application.CreateItem _
                (Outlook.OlItemType.olAppointmentItem)

Dan krijg ik de foutmelding:

Error 1 'CreateItem' is not a member of 'System.Windows.Forms.Application'.
:evil:
 
Did that en krijg:
Code:
Error	1	'OutlookApp' is not declared. It may be inaccessible due to its protection level.
Code:
Error	2	'Marshal' is not declared. It may be inaccessible due to its protection level.

I really feel like a dumb ass :rolleyes:
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan