|
-
Jun 7th, 2006, 11:56 AM
#1
Thread Starter
Junior Member
trying to get a value out of an Activex control
Hi, I am trying to learn how to make my own Activex controls. I made this one, and it works great, which multiplies two numbers and sends the result to a hird text box. Now, I would like to do one more thing with it; that I can not seem to get. I woud like in the main program, that I brought this control into, to be able to send the result form the control to a text box on this main programs form. So for example if on the control text1 = 2, text2 = 3, and text3 = 6 I then want to hit a button and have the results form the control ( which = 6) go to a text box on the form which would show 6 in it. What would I have to do to make this happen?
Thank You
Here is my Code for the control:
Public Event CalculatorClick()
Public Property Get Operand1() As Variant
Operand1 = Text1.Text
End Property
Public Property Let Operand1(ByVal vNewValue As Variant)
Text1.Text = vNewValue
PropertyChanged "Operand1"
End Property
Public Property Get Operand2() As Variant
Operand2 = Text2.Text
End Property
Public Property Let Operand2(ByVal vNewValue As Variant)
Text2.Text = vNewValue
PropertyChanged "Operand2"
End Property
Public Sub CalculateResult()
Text3.Text = Text1.Text * Text2.Text
CalculateResult = Text3.Text
End Sub
Private Sub Command1_Click()
CalculateResult
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Operand1", Text1.Text
PropBag.WriteProperty "Operand2", Text2.Text
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Text1.Text = PropBag.ReadProperty("Operand1")
Text2.Text = PropBag.ReadProperty("Operand2")
End Sub
Public Sub UserControl_Initialize()
End Sub
Last edited by itmasterw; Jun 7th, 2006 at 12:30 PM.
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
|