Problem with .NET Application with domobj

Hello,

I have a problem with an application that I convert from VB6 to Visual Basic 2008.

this application have in the reference domobj.

The application send mail via Lotus Notes.

The VB6 application work fine but when I convert the application in .NET I have a problem

When the .NET application start Lotus Notes crsh (I have 7.0.4 version) and the application dont run.

I thnk the problem is on the reference domobj because when the application start dont make nothing at startup time for send mail or work with Notes.

Please can tou help me?

Thank you very much.

Subject: Problem with .NET Application with domobj.

Are you creating (or using) domino.interop.dll?

Subject: RE: Problem with .NET Application with domobj.

Hello Stan,

thank you for your answer.

I control and I confirm that the new project created from conversion VB6 to VB .NET use domino.interop.dll.

I try to remove this dll but when I try to use domobj the project return to use domino.interop.dll.

Can you help me please?

Thank you very much!

Subject: RE: Problem with .NET Application with domobj.

Don’t try to remove it. Managed code needs to go through Domino.interop.dll – that’s a managed code wrapper for nlsxbe.dll (the COM server for Notes and Domino). That was just getting the easy question out of the way – if you were trying to access native (unmanaged) Notes code directly from an assembly written in VB.NET (like using VB6’s Declare to name a function call into nlnotes.exe, for instance), then crashiness is to be expected. If you are just using the Lotus Domino objects and going through the interop wrapper, then we have to look at other things. There are some things that Mocrosoft didn’t get right in at least a few versions of the interop wrapper, mostly dealing with casting Domino objects from one type to another (like casting a NotesItem to a NotesRichTextItem). I can’t say what’s happening, though, without seeing the code.

Subject: RE: Problem with .NET Application with domobj.

Ok, below the example code, is only to send a mail via Notes.

*** Begin code ***

'This is the declarations:

Global nsess As New NotesSession

Global ndbd As NotesDbDirectory

Global ndb As NotesDatabase

Global ndoc As NotesDocument

Global nrtitem As NotesRichTextItem

Global nembed As NotesEmbeddedObject

'This is the code, I simply send a mail (this is a sample):

On Error Resume Next

nsess.Initialize

On Error GoTo 0

Set ndbd = nsess.GetDbDirectory(nsess.ServerName)

Set ndb = ndbd.OpenMailDatabase

Set ndoc = ndb.CreateDocument

ndoc.ReplaceItemValue “Form”, “Memo”

ndoc.ReplaceItemValue “SendTo”, “test@test.com

ndoc.ReplaceItemValue “CopyTo”, “”

ndoc.ReplaceItemValue “BlindCopyTo”, “”

ndoc.ReplaceItemValue “Subject”, “TEST.”

data01 = Format(Now, “MM/DD/YYYY HH:MM:SS”)

ndoc.ReplaceItemValue “PostedDate”, data01

Set nrtitem = ndoc.CreateRichTextItem(“Body”)

nrtitem.AppendText Trim$(“HELLO”)

nrtitem.AddNewLine

nrtitem.AppendText “”

nrtitem.AddNewLine

Set nembed = nrtitem.EmbedObject(EMBED_ATTACHMENT, “”, c.\filetest.txt)

ndoc.Save False, False

ndoc.Send False

*** End code ***

Thank you very much.

Subject: RE: Problem with .NET Application with domobj.

I post also the code in VB .NET:

Public nsess As New Domino.NotesSession

Public ndbd As Domino.NotesDbDirectory

Public ndb As Domino.NotesDatabase

Public ndoc As Domino.NotesDocument

Public nrtitem As Domino.NotesRichTextItem

Public nembed As Domino.NotesEmbeddedObject





	On Error Resume Next

	nsess.Initialize()

	On Error GoTo 0

	

	ndbd = nsess.GetDbDirectory(nsess.ServerName)

	

	ndb = ndbd.OpenMailDatabase

	

	ndoc = ndb.CreateDocument

	

	ndoc.ReplaceItemValue("Form", "Memo")

	

	ndoc.ReplaceItemValue("SendTo", Trim(Left(iniema.Value, 100)))

	

	ndoc.ReplaceItemValue("CopyTo", "")

	

	ndoc.ReplaceItemValue("BlindCopyTo", "")

	

	ndoc.ReplaceItemValue("Subject", "TEST"

	

	data01 = CDate(VB6.Format(Now, "MM/DD/YYYY HH:MM:SS"))

	ndoc.ReplaceItemValue("PostedDate", data01)

	

	nrtitem = ndoc.CreateRichTextItem("Body")

	

	nrtitem.AppendText"TEST."

	nrtitem.AddNewLine()

	nrtitem.AppendText("")

	nrtitem.AddNewLine()

	nembed = nrtitem.EmbedObject(EMBED_ATTACHMENT, "", "C:\TESTFILE.TXT"

	

	ndoc.Save(False, False)

	

	ndoc.Send(False)

Thank you very much.