Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:21:36+00:00 2026-06-03T17:21:36+00:00

In my program I use WebBrowser control for OAuth. It’s located on vk_auth_window form.

  • 0

In my program I use WebBrowser control for OAuth. It’s located on vk_auth_window form. So in the code I call vk_auth_window.WebBrowser1.Navigate(vkauthurl). If authentication is successful, I silently get token, but if user is not authenticated a form vk_auth_window is showed to them to enter username and password. To check this I catch _DocumentComplete event and check for the right URL. I need no other code being executed until the user finished authentication or closed authentication form.
ShowDialog() does the trick, but it somehow hides cursor from username and password fields in WebBrowser control.
So I introduced a variable Dim showform as Boolean=True in and set it to False from the _DocumenComplete event and in the main code I use infinite loop.

While showform
       System.Threading.Thread.Sleep(100)
       Application.DoEvents()
End While

However it makes userinput slow due to thread sleeps. And If i remove them, it loads CPU quite a lot.
Is there a better way to wait for form to close? What is it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:21:37+00:00Added an answer on June 3, 2026 at 5:21 pm

    Do not use a Timer. Events are made for this.
    You have to subscribe to the FormClosing event of your Form. The code that should be executed after the window is closed has to be in the event handler method.

    Use the AddHanlder keyword.

    AddHandler yourForm.FormClosing, AddressOf FormClosingEventhandler
    

    Later use the event handler to proceed:

    Private Sub FormClosingEventhandler()
        'proceed here
    End Sub
    

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx
    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a program use JNI to call some native directives. My code is:
I have a WinForms form with, amongst other things, a WebBrowser control. I use
I use a program call php easy calendar. Into that, there is a lot
I am using WebBrowser control in the WinForms application. I want to write program
Can I use os.system() or subprocess.call() to execute a Python program on a webserver?
I'm trying to use a .Net WebBrowser control to log into a website and
I need to catch keypresses in my C# program that has a WebBrowser control
I use webBrowser.DocumentText to get the html code of a page. using Regex, i
My program use UdpClient to try to receive 27 responses from 27 hosts. The
I have a flight reservation program use mssql ,For reserving flights i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.