CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2000
    Posts
    440

    What about the 'Me' in ActiveX

    Hello,

    I created an ActiveX control that has a user control and a form.
    the problem is that I cannot figure out how to pass a reference of the user control to the form so that when I have the form displayed I can manipulate the controls on the user form.

    Any ideas?

  2. #2
    Join Date
    Jun 2003
    Location
    Planet Earth
    Posts
    186
    Not sure if I'm understanding what you need, but it sounds like you should be able to create Let/Get Properties to store this info. just like you would a class object. These properties can be manipulated in code or by going to the properties of the control itself.

  3. #3
    Join Date
    Jun 2003
    Location
    Planet Earth
    Posts
    186
    By the way, "Me" has been fired from ActiveX and is now collecting unemployment. Just reference the controls within the ActiveX control itself.

  4. #4
    Join Date
    Feb 2000
    Posts
    440
    That is the problem, suppose that in the project I have the usercontrol and one form. On the usercontrol I have a textbox. When the form is displayed, is it possible that I manipulate the textbox on the usercontrol just from the form.

  5. #5
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    I think you should be able to do something like this:

    Assuming that you have created an instance of your ActiveX control as MyActiveX in your form, you could set textboxes like this:

    Me.MyActiveX.Textbox1.Text = "Some Value"
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  6. #6
    Join Date
    Feb 2000
    Posts
    440
    Probably I cannot explain the situation right but let me try once again.

    1. Create an ActiveX control Project. At this point I have the UserControl1 control.
    2. I drag a text box from the toolbox on the user control
    3. On the project explorer I click on Project1, choose Add -> Form.
    Now I have Form1 as well.

    in the usercontrol I have the following

    Private Sub UserControl_Initialize()
    Form1.Show
    End Sub

    in the form I have

    Private Sub Form_Load()
    ' How can I set the user control text box's text here?
    End Sub


    Maybe I am missing something trivial but, please, let someone put an end to this matter. Thanks.

    [IMG]ftp://sdyn.pirin.com/Valeri/Sample.JPG[/IMG]
    Last edited by vin; October 27th, 2003 at 09:46 AM.

  7. #7
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    Oops, my bad. I didn't realize that you were talking about the form embedded in your usercontrol.

    What about this:
    Private Sub Form_Load()
    ' How can I set the user control text box's text here?
    Textbox1.Text = "Some Value"
    End Sub

    Just like rjm mentioned, just reference the controls by what they are actually called in your project.
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  8. #8
    Join Date
    Feb 2000
    Posts
    440
    Not a chance,

    the text1 is not a memeber of the From but of the UserControl.
    That is why I wanted to pass a reference of the userControl to the form. But it seems that the 'Me' pointer is type of some class that holds all the public properties of the usercontrol but not the private members and the controls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured