Avatar of Kevin Smith
Kevin Smith
Flag for United States of America asked on

Simple .net form to open outlook and populate fields?

I'm trying to make a simple form in vb (using visual studio) where my user can enter an email address, attach document(s), and enter a name, then click submit and it opens the an outlook email to where she can preview the email and then click send...this is my start (below), but it doesn't populate.  If I use With and then automate the send, it does fine, but when i remove the send it doesn't populate.  What am I missing?


Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim Outl As Outlook.Application
        Outl = CreateObject("Outlook.Application")

        Dim olMail As Outlook.MailItem
        olMail = Outl.CreateItem(Outlook.OlItemType.olMailItem)

        olMail.To = "yes@ys.com"
        olMail.Subject = "About our meeting..."
        olMail.Body = _
             "Dear"

        If Outl IsNot Nothing Then
            Dim omsg As Object
            omsg = Outl.CreateItem(0) '=Outlook.OlItemType.olMailItem'
            'set message properties here...'
            omsg.Display(True) 'will display message to user
        End If

    End Sub
Visual Basic.NETOutlook

Avatar of undefined
Last Comment
Kevin Smith

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Nasir Razzaq

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Kevin Smith

ASKER
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23