VB ActiveX Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Akhilez
    New Member
    • Jan 2007
    • 2

    VB ActiveX Problem

    I am writing an activeX control in VB 6. I am using the ocx outside of VB and
    Microsoft, in another application. I dropped the Forms 2.0 textbox on a User
    Control (activex) form to make the ocx. If the Host environment changes the
    .text property for the ocx, the text box updates. If I enter data into the ocx textbox,
    the value is not available to the host environment. It seems that the
    way I have set it up, VB does not expose the data to the host application. (I
    have tried 3 different enviornments). If I drop a textbox right into the host
    application, I can access the properties, sending data both ways so it is not
    the textbox.
    How do I expose the ocx data to the non VB environment?
    I hope this question is not too confusing. Thanks for the help!

    BTW, I grabbed a copy of vb.net 2003 to see if making the control that way
    would make a difference. New and improved, bigger is better and all that.
    It seems that vb.net can not make activex controls. Is that true?



    I looked through some of the discussions and didn't see why this is. Shouldn't
    vb.net be becoming more capable? Is Microsoft dropping support for activex?
    (silly statement but so is losing technology in newer software versions). I have
    been out of the vb.net loop.

    Thanks again for the help.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by Akhilez
    I am writing an activeX control in VB 6. I am using the ocx outside of VB and
    Microsoft, in another application. I dropped the Forms 2.0 textbox on a User
    Control (activex) form to make the ocx. If the Host environment changes the
    .text property for the ocx, the text box updates. If I enter data into the ocx textbox,
    the value is not available to the host environment. It seems that the
    way I have set it up, VB does not expose the data to the host application. (I
    have tried 3 different enviornments). If I drop a textbox right into the host
    application, I can access the properties, sending data both ways so it is not
    the textbox.
    How do I expose the ocx data to the non VB environment?
    I hope this question is not too confusing. Thanks for the help!
    I believe what you need to do is add code in the Procedure Get routine for the Text property, which returns the current value from your textbox.

    Something along these lines (this is not exact, just an illustration).. .
    Code:
    Public Property Get Text() As String
      Text = TextBox.Text
    End Property
    Sorry, can't help with the Vb.Net questions.

    Originally posted by Akhilez
    Shouldn't vb.net be becoming more capable? ... (silly statement but so is losing technology in newer software versions).
    So the question is, would MS drop something useful from a later version of the product? Hahahahaha... don't get me started!

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      Hahahahahahahha hha :D

      Comment

      • Akhilez
        New Member
        • Jan 2007
        • 2

        #4
        Thanks for the replys. The control actually works when I add it to another VB project. So the basic code seems to be right. When I add it to a non-microsoft (or non-VB - I haven't tried C++) development environments, it doesn't work. Does a VB ocx work outside of VB, say in a Delphi enviornment? Or dropping it into a WonderWare project?

        This is what I have for the Get and Lets. I did it manually first, then let the ActiveX Control Interface Wizard build it just to be sure.
        --------------------

        'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
        'MappingInfo=Ri chTextBox1,Rich TextBox1,-1,Text
        Public Property Get Text() As String
        Text = RichTextBox1.Te xt
        End Property
        Public Property Let Text(ByVal New_Text As String)
        RichTextBox1.Te xt() = New_Text
        PropertyChanged "Text"
        End Property

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by Akhilez
          This is what I have for the Get and Lets. I did it manually first, then let the ActiveX Control Interface Wizard build it just to be sure. ...
          It certainly looks alright. However, as for the non-MS question, I don't know. Have never tried.

          Comment

          Working...