deamforever
Programmer
Hi, there,
I am new to VB and ActiveX. So forgive me if my words are not precise.
I want to build an ActiveX control (an .ocx file)in Visual Basic 6 . It has public properties X1,X2,X3,....,X10, all boolean type, and inside this control it is a Label called lblShow.
The function of this ocx is to change the color (backcolor and forecolor) of label lblShow, according to the combinations of X1~X10.
Now I use Public Prorperty Let/Get methods to access X1~X10, which should work fine, for example.
------------------------------------
Public Property Let X1(ByVal newBool As Boolean)
On Error GoTo HandleError
varX1 = newBool
PropertyChanged "X1"
Exit Property
HandleError:
Call ReportError("Let X1", Err.source, Err.Description, "", 0)
End Property
Public Property Get X1() As Boolean
On Error GoTo HandleError
X1 = varX1
Exit Property
HandleError:
Call ReportError("Get X1", Err.source, Err.Description, "", 0)
End Property
...
...
------------------------
Then I want to use varX1~varX10 to change color of lblShow. The logic should be something like
if(varX1 and varX3) lblShow.BackColor=Red
else if (varX2 and varX4) lblShow.BackColor=Yellow
else if ...
end if
But my question is, since I don't want to make a public property which is directly mapped to lblShow.BackColor, how and where shall I put the logic above? When this logic should be excuted?
Do I have to map the lblShow.BackColor to a public property?
Please help with a piece of sample code structure, so I can study and start with.
Thanks in advance!
Deam
I am new to VB and ActiveX. So forgive me if my words are not precise.
I want to build an ActiveX control (an .ocx file)in Visual Basic 6 . It has public properties X1,X2,X3,....,X10, all boolean type, and inside this control it is a Label called lblShow.
The function of this ocx is to change the color (backcolor and forecolor) of label lblShow, according to the combinations of X1~X10.
Now I use Public Prorperty Let/Get methods to access X1~X10, which should work fine, for example.
------------------------------------
Public Property Let X1(ByVal newBool As Boolean)
On Error GoTo HandleError
varX1 = newBool
PropertyChanged "X1"
Exit Property
HandleError:
Call ReportError("Let X1", Err.source, Err.Description, "", 0)
End Property
Public Property Get X1() As Boolean
On Error GoTo HandleError
X1 = varX1
Exit Property
HandleError:
Call ReportError("Get X1", Err.source, Err.Description, "", 0)
End Property
...
...
------------------------
Then I want to use varX1~varX10 to change color of lblShow. The logic should be something like
if(varX1 and varX3) lblShow.BackColor=Red
else if (varX2 and varX4) lblShow.BackColor=Yellow
else if ...
end if
But my question is, since I don't want to make a public property which is directly mapped to lblShow.BackColor, how and where shall I put the logic above? When this logic should be excuted?
Do I have to map the lblShow.BackColor to a public property?
Please help with a piece of sample code structure, so I can study and start with.
Thanks in advance!
Deam