[02/03] RaiseEvent Problem ?
VB Code:
Public Sub processDocument()
Dim document As String
Dim documentBuilder As StringBuilder
If documents.Count <> 0 Then
documentBuilder = documents(0)
document = documentBuilder.ToString
documents.RemoveAt(0)
If document.IndexOf("<auth") >= 0 Then
RaiseEvent AuthRecieved(documentBuilder)
End If
End If
End Sub
Under my Windows Form Designer, i added
AddHandler App.network.AuthRecieved, AddressOf Me.FPD
I got 2 Page, the first page is a login, and it uses the raiseevent as well, the second page does receive the auth tag too.
But it can't proceed on to AddressOf Me.FPD, for my login page, the AddHandler thingy work and i manage to execute the method.
Any help ?
Re: [02/03] RaiseEvent Problem ?
VB Code:
Private _processorThread As Thread
Public Sub New(ByVal clientSocket As Socket)
Me.clientSocket = clientSocket
Me.documents = New ArrayList(10)
Me.response = New StringBuilder
_processorThread = New Thread(New ThreadStart(AddressOf processDocument))
_processorThread.Priority = ThreadPriority.Lowest
_processorThread.Start()
End Sub
VB Code:
Public Sub processDocument()
Dim document As String
Dim documentBuilder As StringBuilder
If documents.Count <> 0 Then
documentBuilder = documents(0)
document = documentBuilder.ToString
documents.RemoveAt(0)
If document.IndexOf("<auth") >= 0 Then
RaiseEvent AuthRecieved(documentBuilder)
End If
End If
End Sub
This is a program, the moment it receive an Auth tag from the server, it will RaiseEvent, the Add Handler is on another page which i implemented.
AddHandler AuthReceived, AddressOf Me.<MethodName>
But the problem, i have 2 sectors of the forms, both forms require <auth> tag from the server, but i can't seem to process the second form as the first form already raise the event, how do i solve this ?
Thank you.
Re: [02/03] RaiseEvent Problem ?
Basically i have a thread which is always check for auth tag coming in, but i got 2 forms which requires the auth raiseevent, the first login page works but the second page which require the auth event doesn't work.
Anyone can guide me on this ?
Do i have to removehandler or is there something to down an event ?
Re: [02/03] RaiseEvent Problem ?
Re: [02/03] RaiseEvent (Handler Stuff) ?
Erm...
For example if i have 2 handler
Addhandler AuthRecieved, AddressOf Me.Login (This is in LOGIN Page)
Another 1 in another FORM
Addhandler AuthRecieved, AddressOf Me.check
The Raise Event is
VB Code:
If document.IndexOf("<auth") >= 0 Then
RaiseEvent AuthRecieved(documentBuilder)
End If
As long the document.IndexOf("<auth") is valid, it will raise the event, BUT i run this on LOGIN Page once and it works, but when i reach the next screen, and i tried receiving the <auth> tag from the server, it simply just don't run my second handler which has the check() method.
Can someone help ? Please ?
Thank you