Results 1 to 9 of 9

Thread: ActiveX and new windows

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    I am creating an ActiveX control. In this control when a button is pressed I want a window to show with a textbox and a button. when the button in the window is pressed I want the window to hide itself and the a textbox on the user control to equal the text in the window's textbox. I have tried adding a form to an ActiveX control project to do this but I can not get the text to transfer. If anyone out there knows how to do the above I would greatly appreciate it.

    vbMichael

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    82

    try this...

    behind control button:
    form2.show vbmodal
    textbox.text = form2.textbox.text

    behind form2 button:
    me.hide

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    With the code suggested it makes the text the same before the form is shown I need to make the text the same when the button on the form is pressed then hide the form. with what I have tried I can't change any control's properties or user control properties through the form. Any way I can do this?

  4. #4
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    are you putting vbmodal after form.show?

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    Yes I am putting vbmodal after the show method of the form.

  6. #6
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    let's see if we are on the same page here. This is what i am doing.

    1. creating new AX control
    2. adding textbox and command button to control
    3. adding form1 to project
    4. behind AX command1:
    form1.show vbmodal
    text1.text = form1.text1.text
    5. behind form1.command1
    me.hide


  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    That is correct with one addition. When the form's command button is clicked the textbox's text (the one on the AX control) will be set to the text in the form's textbox.

  8. #8
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    ok, try this. add form as before, in the AX click put:

    Dim frm As New Form1
    frm.Text1.Text = Text1.Text
    frm.Show vbModal
    Text1.Text = frm.Text1.Text
    Set frm = Nothing


    in form1.command1 click put
    me.hide


  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    your code works fine but I found you don't need to create a new instance of form1. Is there a reason for it?
    Thank you

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