|
-
May 29th, 2005, 02:26 AM
#1
Thread Starter
Member
OnComm event doesn't fire
I try to use the code below, and OnComm() doesn't fire 
receiver side :
Dim MSComm1 As New MSCommlib.MSComm
Private Sub Form_Load()
Form1.Caption = "App2"
With MSComm1
.Handshaking = 2 - comRTS
.CommPort = 1
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
End With
Text1.Text = ""
End Sub
private sub Form_Unload(Cancel as Integer)
MSComm1.PortOpen = False
end Sub
private sub MSComm1_OnComm()
MsgBox "some comm event has arrived"
select case MSComm1.CommEvent
case .......
case ....
end select
end sub
sender side:
Dim MSComm1 As New MSCommlib.MSComm
Private Sub UserForm_Initialize()
Form1.Caption = "App1"
With MSComm1
.Handshaking = 2 - comRTS
.CommPort = 1
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
End With
CommandButton1.Caption = "&Send"
TextBox1.Text = "Test string from App1 "
End Sub
Private Sub CommandButton1_Click()
MSComm1.Output = TextBox1.Text
End Sub
Could you plz tell me what am i doing wrong....
the connection is ok. in case in receiver side i call myself the OnComm Sub the data transfers.
10x in advance
-
May 29th, 2005, 06:34 AM
#2
Thread Starter
Member
Re: OnComm event doesn't fire
i solved the problem...
I don't think that anyone has the same problem, but ...
the problem was in the first line : Dim MSComm1 As New MSCommlib.MSComm
the correct line is : Public WithEvents MSComm1 As MSCommlib.MSComm
and than inside the sub add the line : Set MSComm1 = CreateObject("MSCommlib.MScomm")
-
Apr 16th, 2007, 03:49 AM
#3
New Member
Re: OnComm event doesn't fire
In order for the OnComm event to fire, you need to set RThreshold and SThreshold to 1.
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
|