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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

freezing form

Status
Not open for further replies.

jcisco

Programmer
Sep 17, 2002
125
US
I have a modual that uses a sub main, and creates my main form. loads just fine.
Now the main form calls the mod and does stuff (alot of stuff). Now the problem is my form freezes up until the processes are complete is there a way to prevent this from happing? In vb 6 there was doevents() which is not the same in .net. I have tried using threads but that is not working either. code sample for threads.


'these functions are on my main form
Private Sub doStuff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles doStuff.Click

Dim t As System.Threading.Thread
t = New System.Threading.Thread(AddressOf Me.startBackGround)

Dim first As Boolean = False
While OutFile() 'this calls a function in my MOD that checks a directory. this function looks to see if it's empty ifnot it will call a function do process the data.
tmrCreatePackage.Enabled = False
If first = False Then
first = True
t.Start()
End If
End While
t.Suspend()
first = False
tmrCreatePackage.Enabled = True
End Sub

Private Sub startBackGround()
SyncLock PrepareFile() 'process the files in the dir.
End SyncLock
End Sub

comments?
this is a quick update from vb 6 to .net thus the mods and not classes.

--------------
:)
 
got it.. form.refresh()


--------------
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top