I am sill having fun with the Serial class. I have created a wrapper class (composition) rather than a subclass, so my wrapper has some useful things and a ‘SP’ property that is assigned a fresh instance of Serial when I want to open it. That part works well but I just want to explain the composition aspect in case it is relevant to the problem. (I am not using a Serial component dropped on a form)
In the code below I want to get the Serial DataAvailable event to fire my own MyDataAvailable event (created by adding an Event Definition to my wrapper class) but the code completion does not reveal the Serial DataAvailable event and so I get a nice red bug against the last line below. I have scratched my head and Googled docs + articles but I cannot work it out. Please somebody tell me what I am doing wrong
No it is a good question, I do but the problem seems to occur before that.
If I create a brand new app with just a window and then say, code the open event with
Dim s as new Serial()
AddHandler s. [tab] there is no DataAvailable event in the code completion.
If I forge ahead and type it out then I get a compile error ‘This item does not exist’. Changing Serial to TCPSocket() doesn’t show a DataAvailable event either? I feel like I am missing something important so I am blaming myself first of all but I cannot work it out.
That is exactly what I am trying to do. I want to get the DataAvailable event from Serial to fire my own ‘intermediary’ event MyDataAvailable by using AddHandler.
Looking at the Language Reference for AddHandler there is an example for a Timer that works
My HandleEvent method gets invoked by the Timer every second and displays a MessageBox as expected. So why can’t I use AddHandler to do the same with the Serial DataAvailable event?