Results 1 to 8 of 8

Thread: Raise Event to get value!!! [need ur help, pls help me]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Question Raise Event to get value!!! [need ur help, pls help me]

    i hv uses the raise event to get the value back to Form A, but there is no expected output display....is it i my way got problem? the receivemessage method is start called from Form A timer

    VB Code:
    1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2.  
    3.         client.ReceiveMessage()
    4. End Sub

    VB Code:
    1. // class method
    2. Public Event displayMessage(ByVal message As String)
    3.  
    4. Public Sub ReceiveMessage()
    5.  
    6.         client.GetStream.BeginRead(rBuffer, 0, rBufferSize, AddressOf read,
    7.          Nothing)
    8.  
    9. End Sub
    10.  
    11. Public Sub read(ByVal dataIn As IAsyncResult)
    12.         Dim ByteRead As Integer
    13.  
    14.         Try
    15.  
    16.             ByteRead = client.GetStream.EndRead(dataIn)
    17.             MsgBox(ByteRead)
    18.             message = Encoding.ASCII.GetString(rBuffer, 0, ByteRead)
    19.             MsgBox(message)
    20.  
    21.             getMessage = True
    22.  
    23.             If getMessage Then
    24.                 RaiseEvent displayMessage(message) //message value is public
    25.             End If
    26.  
    27.         Catch
    28.         End Try
    29.     End Sub

    In Form A:
    VB Code:
    1. Private WithEvents client1 As clientConnect
    2.  
    3. Private Sub loadMessage(ByVal message As System.String) Handles client1.displayMessage
    4.  
    5.         Dim frmMessage As FrmInstantMessage = New FrmInstantMessage
    6.         frmMessage.Show()
    7.         frmMessage.txtMessageList.Text = message & vbCrLf
    8.  
    9.  End Sub
    Last edited by kenny_oh; Aug 30th, 2005 at 10:23 AM.

  2. #2
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Re: Raise Event to get value!!!

    i hv facing problem of couldnt get the value from the raise event !!! anyone can tell me what is the problem??? the problem is in the Form A part

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Re: Raise Event to get value!!! [need ur help, pls help me]

    anyone can help solve the problem?

  5. #5
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: Raise Event to get value!!! [need ur help, pls help me]

    kenny_oh

    I suggest you first try events without the timer and stream reading etc. Just instantiate a subform from the main form, click a button on the subform and make it raise the displayMessage that you'll catch and display in a simple textbox on the main form. Once you're discovered the instricacies of events you can then try it with timers, streats etc.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Re: Raise Event to get value!!! [need ur help, pls help me]

    i hv make some change on the code where can display the form but hang it half way.....cannot display complete!! dont know y....bcoz i hv follow everything and at the event handling load message there should be the main problem!!

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Re: Raise Event to get value!!! [need ur help, pls help me]

    the raise event and event handling doesnt hv any problem...can get the value pass from the raise event...but cannot load the form completely.....hang half way.........pls help me, my homework deadline near, i need to solve this task but i try many method liao.......pls!!!

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Re: Raise Event to get value!!! [need ur help, pls help me]

    this problem, i stil couldnt solve since two week alr.......i really need the resolution..pls i hv try many method but same problem stil exits...the value i can get alr but the value cannot display in the form.........

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