Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a VB.Net project. Using Google Drive Api v3.0.
A part of my assignment is to get the Webbrowser Control in the project to make all the calls to the Api, not the Windows default browser.
I found this code here : oauth-apps-for-windows/Program.cs at master · googlesamples/oauth-apps-for-windows · GitHub[^]
It is written in C#. It is a working example. I have tested it in c#. I'm making some changes in it to be suitable for my assignment, but I'm stuck with this code, which I can not convert to VB.Net :

Task responseTask = responseOutput.WriteAsync(buffer, 0, buffer.Length).ContinueWith((task) =><br />
            {<br />
                responseOutput.Close();<br />
                http.Stop();<br />
                Console.WriteLine("HTTP server stopped.");<br />
            });

Line 104 to Line 109.
Thank you.

What I have tried:

I tried this :
VB
Dim responseTask As Task = responseOutput.WriteAsync(Buffer, 0, Buffer.Length).ContinueWith((Task) >= _)
        If True Then
            responseOutput.Close()
            Http.Stop()
            Debug.WriteLine("HTTP server stopped.")
        End If

but with Error in ContinueWith((Task) >=_) part.
Posted
Updated 8-May-20 19:36pm

1 solution

For an example of .ContinueWith() see: Chaining Tasks by Using Continuation Tasks | Microsoft Docs[^]
It should look like this:
taskA.ContinueWith(Sub(antecedent)
  Console.WriteLine("Today is {0}.", antecedent.Result)
  End Sub)

You might also need a higher version of the .NET framework, 4.5 or higher.
 
Share this answer
 
Comments
evry1falls 9-May-20 13:49pm    
Thank you so much. That solved the problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900