|
-
Aug 30th, 2005, 06:01 AM
#1
Thread Starter
Fanatic Member
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:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
client.ReceiveMessage()
End Sub
VB Code:
// class method
Public Event displayMessage(ByVal message As String)
Public Sub ReceiveMessage()
client.GetStream.BeginRead(rBuffer, 0, rBufferSize, AddressOf read,
Nothing)
End Sub
Public Sub read(ByVal dataIn As IAsyncResult)
Dim ByteRead As Integer
Try
ByteRead = client.GetStream.EndRead(dataIn)
MsgBox(ByteRead)
message = Encoding.ASCII.GetString(rBuffer, 0, ByteRead)
MsgBox(message)
getMessage = True
If getMessage Then
RaiseEvent displayMessage(message) //message value is public
End If
Catch
End Try
End Sub
In Form A:
VB Code:
Private WithEvents client1 As clientConnect
Private Sub loadMessage(ByVal message As System.String) Handles client1.displayMessage
Dim frmMessage As FrmInstantMessage = New FrmInstantMessage
frmMessage.Show()
frmMessage.txtMessageList.Text = message & vbCrLf
End Sub
Last edited by kenny_oh; Aug 30th, 2005 at 10:23 AM.
-
Aug 30th, 2005, 06:05 AM
#2
Re: Raise Event to get value!!!
-
Aug 30th, 2005, 06:54 AM
#3
Thread Starter
Fanatic Member
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
-
Aug 30th, 2005, 11:14 AM
#4
Thread Starter
Fanatic Member
Re: Raise Event to get value!!! [need ur help, pls help me]
anyone can help solve the problem?
-
Aug 30th, 2005, 01:24 PM
#5
Fanatic Member
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 ...
-
Aug 30th, 2005, 09:50 PM
#6
Thread Starter
Fanatic Member
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!!
-
Sep 1st, 2005, 07:33 AM
#7
Thread Starter
Fanatic Member
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!!!
-
Sep 6th, 2005, 04:16 AM
#8
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|