FabulaTech Forum Senior Member
Re: Bug in .EventChar ??
« Reply #1 on: Sep 28th, 2009, 1:43am »
It's not a bug of Serial Port Control, it's feature of VB6.
When you create "several (5) instances of Serial Port Control object"
by simple copying of the object which is taken from the Toolbox - the same-name
massif of objects with the indexes from 0 to 4 (in your case) is created. But in
VB6 the names of event handlers are created in the following way: ObjectName_OnXXX, where XXX - is the event. In your case SPC_1_OnEventChar works out if Event char comes to any of COM ports. In order to "catch" the events
separately the Serial Port Control objects must have different names. So every
Serial Port Control object must be put on the Form from the toolbox directly.
In this case they will have the following names (a kind of): FTSPCControl1,
FTSPCControl2, FTSPCControl3 etc.
So accordingly the events will be FTSPCControl1_OnEventChar, FTSPCControl2_OnEventChar, FTSPCControl3_OnEventChar etc.
In case you still have any questions feel free to ask