• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Script Control 1.0

Hi there,
When you add a form to a script control, does it also add the controls on the form, or do I need to add those independently?

Thanks!
Brett
0
brspurri
Asked:
brspurri
1 Solution
 
Da_WeaselCommented:
Yes, make a project with 2 forms (Form1 and Form2)
Add a Command Button (Command1) and Textbox (Text1) to Form1.
Add a Checkbox (Check1) to Form2
Add a reference to the Microsoft Scripting Control (Project>References)
Paste the following code into Form1:

Option Explicit
Dim mySC As ScriptControl

Private Sub Command1_Click()
mySC.ExecuteStatement Text1.Text
End Sub

Private Sub Form_Load()
Set mySC = New ScriptControl
mySC.Language = "VBScript"
mySC.AddObject "TheOtherForm", Form2
End Sub

run the program and type this into the textbox:
TheOtherForm.Show
click the Command1
the second for should be shown
now put this in the textbox
TheOtherForm.Check1.Value = 1
click Command1
the checkbox on Form2 should now be checked.

0
 
CleanupPingCommented:
brspurri:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept Da_Weasel's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now