-
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
-
try this...
behind control button:
form2.show vbmodal
textbox.text = form2.textbox.text
behind form2 button:
me.hide
-
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?
-
are you putting vbmodal after form.show?
-
Yes I am putting vbmodal after the show method of the form.
-
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
-
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.
-
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
-
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