Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write in VB.NET or VC#.NET "please wait.."?

Status
Not open for further replies.

hvytas

Programmer
Aug 10, 2005
23
LT
Hello,

I have a problem for creating in VB.NET or VC#.NET waiting dialog window, the problem is that not well working in retail version then I compiled all project and using waiting window, ho know how to solve this problem?

I using more data and created simple waiting window in .NET for waiting until process terminated automaticly, but automaticly for me not well working, If I create a simple class and it created in begin of function it automaticly destroing only in Debug version.

I using in VB.NET this:
Friend Class clsWait

#Region " Waiting... "

Private fWait As frmWait ' Is Waiting Form

Public Sub New()
fWait = New frmWait
fWait.Show()
Application.DoEvents() ' DoEvents
End Sub

Public Sub Unload()
Finalize()
End Sub

Protected Overrides Sub Finalize()
fWait.Hide()
MyBase.Finalize()
End Sub

#End Region

End Class

In functions or procedures using only beggining of it:

Dim cWait As New clsWait ' Automaticly Finalize it if exit from
' function or procedure, only work in Debug mode?
...<code>...

P.S. Sorry for my English
 
Maybe you should dispose the form correctly by having your class implement IDisposable:

Code:
Implements IDisposable

Public Overloads Sub Dispose() Implements IDisposable.Dispose
  Dispose(True)
  GC.SuppressFinalize(Me) 'Let the garbage collector do the work for you
End Sub

Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
  If disposing Then
    'dispose any other objects your class uses here and set large variables like big arrays to nothing
  End If
End Sub

Protected Overrides Sub Finalize()
  Dispose(False)
End Sub

I'm not sure if this will directly solve your problem, but it's a step in the direction I guess.

Code:
Dim cWait As New clsWait
'
'
cWait.Dispose

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
I think this code is acceptable, the problem is likely in how you are calling it. If I understand your post correctly, you are trying to show this form while executing other code in the back ground. The best solution would be to move that other code into it's own thread. Check this faq for more information on threading: faq796-5929

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top