A VB.NET desktop application freezes while waiting for a web request. How would you redesign it?
Interactive Practice Mode
Formulate your thoughts or take notes before revealing the model solution.
Saved automatically
Model Answer & Deep-Dive Explanation
Use a genuinely asynchronous I/O API and Await it from an asynchronous event handler so the UI message loop can continue processing input. Keep longer CPU-bound work off the UI thread where appropriate, and update controls on the correct thread. Disable or coordinate repeated submissions, expose cancellation, and handle exceptions with a useful UI state. Avoid blocking on Task.Result or Wait. Async Sub is appropriate for framework event-handler signatures; reusable asynchronous methods should generally retu Task or Task(Of T) so callers can await completion and observe errors.
Related Questions in Visual Basic
VB 6, COM, DCOM, Microsoft platform interview questions
Advanced level • 727 views
Visual Basic Interview questions
Advanced level • 643 views
How do ByVal and ByRef behave when a VB.NET parameter refers to an object?
Medium level • 3 views
Why should VB.NET file handling use a Using block?
Medium level • 3 views
In VB.NET, how do Sub and Function differ?
Easy level • 2 views