 |
|
|
Topic: Input Property throws Compiler error
|
By: Mitch | Posted on: Aug 20 2014 at 12:50:38 PM | In my program, I am trying to read back the Input property (containing all the received data) and whenever I try to enter the _OnComm subroutine I get the error:
"Compile error: Method or data member not found". The autocomplete text considers SComm.Input a valid property. Please help !
Thanks | |
By: Guest | Posted on: Aug 20 2014 at 09:21:56 PM | Input is a valid method but for some reason it's only accepted if the ocx is being used on a Form or if it's created in code as object. For example
Dim myComm as Object
Set myComm = CreateObject("SComm32.SComm")
| |
By: Mitch | Posted on: Aug 21 2014 at 01:41:38 PM | I found a work around (if you dont want to place it in a form). You would need to create an event handling class which should help solve this issue.:
Public WithEvents Comm As SComm32.SComm
Private Sub Comm_OnComm()
Call COM_INTERFACE.OnCommEvent
End Sub
Private Sub Class_Initialize()
Set Comm = CreateObject("SComm32.SComm")
End Sub
------------------------------------------
Your code to handle this handler would look like:
Private SComm As Object
Private eventHandler As Object
Set eventHandler = New RS232_EventHandler
Set SComm = eventHandler.Comm
-----------------------------------------------
This would then allow you to use SComm as you would otherwise use it to access the .Input method without needing to put it in a form. | |
|