Dear all,
I'm creating a little command line tool with Visual Basic which shall delete all entries from a MultiTerm termbase which has about 4000 entries.
I'm using MultiTerm 18.1.2.3594 and have set a reference to "C:\Program Files (x86)\Common Files\Trados\MultiTerm18\Sdl.MultiTerm.TMO.dll".
Im using the following for... next loop:
For entryCount = 1 To oTb.Entries.Count
Console.WriteLine($"EntryCount: {entryCount}")
If oTb IsNot Nothing Then
If oTb.Entries IsNot Nothing Then
oTb.Entries.Item(oTb.Entries.GetEntryIDs(entryCount)).Delete()
End If
End If
Next
Unfortunately, runnnig that loop leads to the following error message after running some time and deleting entries as expected.
"An HRESULT E_FAIL error was returned when calling a COM component.
StackTrace: at MultiTermIX.IEntryIDs.get_Item(Int32 Index)
at MultiTerm_BatchImportExport.DatabaseImportExport._Closure$__6-0._Lambda$__1() in C:\tmp\MultiTerm-BatchImportExport.vb:Line 168."
What I'm really wondering about is, that the error is gone, if I'm exchanging the context of line 168, which is "oTb.Entries.Item(oTb.Entries.GetEntryIDs(entryCount)).Delete()", by "Console.WriteLine($"Content: {oTb.Entries.Item(oTb.Entries.GetEntryIDs(entryCount)).Content.Content}")".
I don't have any clue, why deleting the entries leads to that error, but listing the context of each entry does not.
Please be so kind to let me know, what I'm doing wrong.
Any help and even a hint, pointing me in the right direction is very much appreciated.
If you have any further question or if you need any further information, please don't hesitate to let me know.
Best regards and have a nice day.
Nils
Translate