Home All Groups Group Topic Archive Search About

call a control that is on another form using an array.

Author
6 Mar 2006 10:52 PM
Mark
I have 2 forms on form1 I have a button that is suppose to fire a command
button on the 2nd form. The control it is suppose to call  is stored in an
array. I have to do this because I have alot of  buttons that might have to
stored.

Array(0) = "Formname"
Array(1) = "Commandbutton1_Click"

Using a scriptcontrol I'm doing the following:

temp = array(0) & "." & array(1)
ScriptControl1.ExecuteStatement temp

I get an object required error. The object it is referring to is the form
name.

Can someone tell me what I'm doing wrong or another way to do this.

Thanks Mark

Author
6 Mar 2006 11:58 PM
Anthony
Did you expose the form itself to the script control? If so, did you expose
it as the ACTUAL form name, or some other name?

It would look something like this:

ScriptControl1.AddObject "form1", form1

The "form1" in quotes is the name your script control will use, and can be
different than the actual form name VB6 knows about.


--
Anthony Dunleavy
www.atrixware.com




Show quoteHide quote
"Mark" wrote:

> I have 2 forms on form1 I have a button that is suppose to fire a command
> button on the 2nd form. The control it is suppose to call  is stored in an
> array. I have to do this because I have alot of  buttons that might have to
> stored.
>
> Array(0) = "Formname"
> Array(1) = "Commandbutton1_Click"
>
> Using a scriptcontrol I'm doing the following:
>
> temp = array(0) & "." & array(1)
> ScriptControl1.ExecuteStatement temp
>
> I get an object required error. The object it is referring to is the form
> name.
>
> Can someone tell me what I'm doing wrong or another way to do this.
>
> Thanks Mark
>
>
>