dumb question

  • Thread starter Thread starter Tim Gallivan
  • Start date Start date
T

Tim Gallivan

Hello,

I'm new to the ASP side of dot net, and I can't figure this out. I have a
button on a web form. When clicked, it creates a class and adds 2 event
handlers. It takes about five seconds before either event is raised. My
problem is that the page is sent back to the browser before one of the
events are raised. How can I get around this?

Thanks in advance,
Tim Gallivan

Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTest.Click
Dim rr As New Class1()
AddHandler rr.Finished, AddressOf OnRRFinished
AddHandler rr.ErrorState, AddressOf OnRRErrored
rr.Start()
End Sub

Private Sub OnRRFinished()
TextBox1.Text = sContent
End Sub

Private Sub OnRRErrored()
TextBox1.Text = sMessage
End Sub
 
Hi Tim.
You can delay the thread of execution somehow.
But it is not usually done in web environment.
Try to find another way of implementing those events.
Sharon.
 
Thanks for the idea Sharon,

It works with a
Shared allDone As New System.Threading.ManualResetEvent(False)

at the top of the class and allDone.WaitOne() to block, allDone.Set() to
exit ...
 
Back
Top