Results 1 to 6 of 6

Thread: [02/03] RaiseEvent Problem ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    [02/03] RaiseEvent Problem ?

    VB Code:
    1. Public Sub processDocument()
    2. Dim document As String
    3. Dim documentBuilder As StringBuilder
    4. If documents.Count <> 0 Then
    5. documentBuilder = documents(0)
    6. document = documentBuilder.ToString
    7. documents.RemoveAt(0)
    8. If document.IndexOf("<auth") >= 0 Then
    9. RaiseEvent AuthRecieved(documentBuilder)
    10. End If
    11. End If
    12. 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 ?
    Last edited by Winder; Jun 13th, 2006 at 04:23 AM. Reason: RaiseEvent Problem ?

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [02/03]

    Hi,

    The way you started your thread isn't the way it should be.
    1. What's your problem? Write your question next to the version you mentioned.
    2. What do you want your code should be doing.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    Re: [02/03] RaiseEvent Problem ?

    VB Code:
    1. Private _processorThread As Thread
    2.  
    3.     Public Sub New(ByVal clientSocket As Socket)
    4.         Me.clientSocket = clientSocket
    5.         Me.documents = New ArrayList(10)
    6.         Me.response = New StringBuilder
    7.        
    8. _processorThread = New Thread(New ThreadStart(AddressOf processDocument))
    9.         _processorThread.Priority = ThreadPriority.Lowest
    10.         _processorThread.Start()
    11.     End Sub

    VB Code:
    1. Public Sub processDocument()
    2.         Dim document As String
    3.         Dim documentBuilder As StringBuilder
    4.                     If documents.Count <> 0 Then
    5.                 documentBuilder = documents(0)
    6.                 document = documentBuilder.ToString
    7.                 documents.RemoveAt(0)
    8.                 If document.IndexOf("<auth") >= 0 Then
    9.                     RaiseEvent AuthRecieved(documentBuilder)
    10.                 End If
    11.             End If
    12. 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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    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 ?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    Re: [02/03] RaiseEvent Problem ?

    Please help... Thank you

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    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:
    1. If document.IndexOf("<auth") >= 0 Then
    2. RaiseEvent AuthRecieved(documentBuilder)
    3. 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width