chacham
Member
- Local time
- Today, 00:24
- Joined
- Oct 26, 2020
- Messages
- 45
I have a VB.NET DLL that uses Async/Await in most of its calls due to using HttpClient (docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) in many of its calls. I now want to call it from Access. After making the DLL COM visible and interopable, and registering it, the call from Access was successful, evidenced by popping up a message box.
However, when calling an Async Function, the code exits at the Await. That is, if the function is:
The MessageBox showing "a" is seen, but the one for "b" is not and the caller does not see the result. Obviously, that is exactly what it is supposed to do, as that is the entire point of the Await modifier. In VB, however, i can call the function itself with Await, and it will await the result, but it does not look like Access supports the Await keyword.
Is there a way to await the function in Access or in anyway get the results, such as through event handling or a callback? Or do i need to rewrite the DLL to not use HttpClient?
However, when calling an Async Function, the code exits at the Await. That is, if the function is:
Code:
Public Async Function test() As Task(of String)
Dim Result as String
MsgBox("a")
String = Await something()
MsgBox("b")
Return Result
End Function
The MessageBox showing "a" is seen, but the one for "b" is not and the caller does not see the result. Obviously, that is exactly what it is supposed to do, as that is the entire point of the Await modifier. In VB, however, i can call the function itself with Await, and it will await the result, but it does not look like Access supports the Await keyword.
Is there a way to await the function in Access or in anyway get the results, such as through event handling or a callback? Or do i need to rewrite the DLL to not use HttpClient?