fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

How to 'await' the result of a .Net routine called from VO? 04 May 2021 23:38 #18311

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 938
  • I have created a WPF window which can import Excel sheets into a DBF using Microsoft.Office.Interop.Excel. This is all done in my DotNet DLL containing X# and C# routines and called like this:

    oDotNet:= OLEAutoObject{"DotNetLibForVO.VoDotNetClass"}
    IF oDotNet:Finit
    // assign some parameters
    oDotNet:ShowExcelWin(cPathExt,cFileExt,cHeadersExt,cTypesExt)
    ENDIF
    // What happens next should wait but it doesn't

    The problem is that everything which happens in that Excel window works like a ASYNC call, or a modeless window, and the VO code continues once it has started the ShowExcelWin in X#. But I want the program to be able to find out if the Excel import has been finalized.

    I can use a simple trick of course, like creating a file or something, but is there a more advanced way to let VO await the finalizing of the ExcelImport window from the X# DLL?

    EDIT: seconds after I posted it, I found the solution (for this situation at least): I can use ShowDialog instead of Show for a WPF window. But I am still interested in other solution, not involving windows but still with the need to await the result.

    Dick

    Please Log in or Create an account to join the conversation.

    Last edit: by ic2. Reason: see EDIT
    • Page:
    • 1