By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,989 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,989 IT Pros & Developers. It's quick & easy.

waiting form get disappeared while executing long process

P: 23
I am trying to display waiting message which is actually a form while long process is running in some different file. Issue i am facing is the form get disappeared once the process gets started but its still active and running the process

My code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim objWait As New frmWaitupdate
  3.     Dim strReply As String
  4.  
  5.     Dim ischange As Boolean
  6.     Dim obj1 As New MyBO.UpdateSchemaBO()
  7.     ischange = obj1.CheckSchemaChanges(Application.ProductVersion.ToString())
  8.  
  9.     If ischange = True Then
  10.  
  11.         lblMsg.Text = "Schema changes found please wait  Please wait."
  12.  
  13.         obj1.AddVersionTable(Application.ProductVersion.ToString())
  14.         Me.Visible = True
  15.  
  16.         strReply = obj1.UpdateSchema(Me)
  17.         If strReply <> "" Then
  18.             MessageBox.Show(strReply, "abc")
  19.         Else
  20.             MessageBox.Show("Schema updated successfully", "abc")
  21.         End If
  22.  
  23.  
  24.         'objWait.Hide()
  25.     ElseIf ischange = False Then
  26.  
  27.         MessageBox.Show("No schema changes found", "abc")
  28.  
  29.  
  30.         End If
  31.  
  32.     End If
As the process goes in UpdateSchema() which takes around 30-45 sec to finish the form gets disappear.Is there any way to keep the form intact on screen until my process gets complete??
Feb 28 '13 #1

✓ answered by Mikkeee

skavinkar, any task that's going to take that long will probably make your app unresponsive until it's finished. I would recommend that you place your long running function in another thread so the UI remains responsive. A fairly easy solution would be to place a background worker on your form. The background worker is nice because it allows you to show progress/status on the UI thread while keeping the main routine on another thread.

See the MSDN help: http://msdn.microsoft.com/en-us/libr...undworker.aspx

Share this Question
Share on Google+
1 Reply


Mikkeee
P: 94
skavinkar, any task that's going to take that long will probably make your app unresponsive until it's finished. I would recommend that you place your long running function in another thread so the UI remains responsive. A fairly easy solution would be to place a background worker on your form. The background worker is nice because it allows you to show progress/status on the UI thread while keeping the main routine on another thread.

See the MSDN help: http://msdn.microsoft.com/en-us/libr...undworker.aspx
Feb 28 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.