DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Running Diadem From Within VB.NET

I use the following snippet of code that works for my needs using VB.NET 

 

oDiadem = New DIAdem.TOCommand

'Save Diadem file as TDM in the specified folder.

nDiademStatus = oDiadem.TextVarSet("T3", sFolderPath & "\" & sFileName & ".TDM")
oDiadem.CmdExecuteSync("DataFileSave(T3, 'TDM')")

'Close down diadem

oDiadem.CmdExecuteSync("DataDelAll(1)")
nDiademStatus = oDiadem.TextVarSet("T3", "ignore") '
oDiadem.CmdExecuteSync("FileModification:= T3")

oDiadem.CmdExecuteSync("ProgramExit()")

oDiadem = Nothing 

The file save works fine, but at the "ProgramExit()" call. I get the following error (see attached screen shot)

 

Clicking OK closes the dialog by the instance of Diadem remains running in memory

 

 

0 Kudos
Message 1 of 4
(2,581 Views)

I use:

FileModification = "ignore" ' Just like you do in code pasted below
' nDiademStatus = oDiadem.TextVarSet("T3", "ignore") '
' oDiadem.CmdExecuteSync("FileModification:= T3") ' Instead of Call ProgramExit() i use: Application.Exit()

I do this in DIAdem script so the last line would look different in your code

0 Kudos
Message 2 of 4
(2,574 Views)

Hi

 

Thanks for the suggestion but it does not work for application.

 

Tried the following :

oDiadem.CmdExecuteSync("Exit()")

and 

oDiadem.CmdExecuteSync("ApplicationExit()")

 

Also tried using the CmdExecuteAscync, but still get the same error.

 

 

 

 

0 Kudos
Message 3 of 4
(2,567 Views)

if DIAdem wasn't started before it will disappear if ODIAdem is destroyed.

 

Dim oDIAdem, iSuccess
Set oDIAdem = CreateObject("DIAdem.TOCommand")
If Not oDIAdem.bInterfaceLocked then
  iSuccess = oDIAdem.CmdExecuteSync("MsgBoxDisp(""hello"")")
End If 

If you run this using cscript you will see DIAdem start show Message box and disappear.

I am not sure how it is made sure in .net garbage collection that the object is destroyed.

0 Kudos
Message 4 of 4
(2,529 Views)