Send with LNotes 6.5.4 using VB2008express - Notes hangs

I am trying to send a mail from my vb application.After clicking the button, My Notes just hang up and I have to restart the computer. Please help.

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    'Lotus Domino Test

    Dim Maildb As Object

    Dim MailDoc As Object

    Dim Body As Object

    Dim ns As New Domino.NotesSession



    'This line prompts for password of current ID noted in Notes.INI 

    ns.Initialize()





    'Open the mail database in notes 

    Maildb = ns.GetDatabase("", "D:\notes6\data\mail\atapa15.nsf")

    If Not Maildb.IsOpen = True Then

        Call Maildb.Open()

    End If



    'Create the mail document 

    MailDoc = Maildb.CREATEDOCUMENT

    Call MailDoc.ReplaceItemValue("From", "finding_nemo@hi.com")



    'Set the recipient 

    Call MailDoc.ReplaceItemValue("SendTo", "dori_dafish@hi.com")



    'Set subject 

    Call MailDoc.ReplaceItemValue("Subject", "Test Sending")



    'Create and set the Body content 

    Body = MailDoc.CREATERICHTEXTITEM("Body")

    Call Body.APPENDTEXT("Test message")



    'Example to create an attachment (optional) 

    'Call Body.ADDNEWLINE(2)

    Call Body.EMBEDOBJECT(1454, "", "C:\app1.zip") '(1454, "", "C:\", "app1")



    'Example to save the message (optional) 

    MailDoc.SAVEMESSAGEONSEND = True



    'Send the document 

    'Gets the mail to appear in the Sent items folder 

    Call MailDoc.ReplaceItemValue("PostedDate", Now())

    Call MailDoc.SEND(False)



    'Clean Up 

    Maildb = Nothing

    MailDoc = Nothing

    Body = Nothing

    'Session = Nothing



End Sub

Subject: Send with LNotes 6.5.4 using VB2008express - Notes hangs

There’s no obvious reason for things to be hanging, but there are some problems with your code. First, there’s no reason to set the PostedDate item, it’s set automagically when the message is sent. And iff you are going to release Notes objects, start at the bottom and work your way up – use Marshal.ReleaseCOMObject() instead of setting the object to Nothing.