View previous topic :: View next topic |
Author |
Message |
Frank Bonefont KiXforms Novice

Joined: 23 Dec 2007 Posts: 3 Location: Riverside, CA
|
Posted: Sun Dec 23, 2007 9:20 am Post subject: I want to close a form |
|
|
I want to close a form using a Function statement. I'm coding in vbScript and using a kiXForm in the code. I receive the following error message:
C:\Documents and Settings\Dad\My Documents\AdminScriptEditor\bkuprstr3.vbs(131, 2) Microsoft VBScript runtime error: Type mismatch: 'Close'
I appreciate your help...
'~~< Form1> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim Form1: Set Form1 = System.Form()
Form1.Text = "Backup/Restore:"
'~~< CancelButton ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim CancelButton: Set CancelButton = Form1.Controls.Button
CancelButton.Size = System.Size(102, 21)
CancelButton.Text = "Cancel..."
CancelButton.Location = System.Point(175, 212)
CancelButton.OnClick = "Exit_Form( CancelButton )"
.
.
.
'region Event Handlers
Function Exit_Form( Object )
Close()
End Function
'endregion |
|
Back to top |
|
 |
Shawn KiXforms Developer


Joined: 22 Feb 2003 Posts: 1983 Location: Canada
|
Posted: Sun Dec 23, 2007 10:19 pm Post subject: |
|
|
Couple ways to do this ...
1) If you want to close the form but continue executing code after the DoEvents loop, I would just Form.Hide inside your Exit_Form function ... this will cause the loop to finish (because Form.Visible will be false) ... then just carry-on after the loop
2) If you want to close the form and the script, maybe just WScript.Quit from inside the function.
-Shawn |
|
Back to top |
|
 |
Frank Bonefont KiXforms Novice

Joined: 23 Dec 2007 Posts: 3 Location: Riverside, CA
|
Posted: Mon Dec 24, 2007 3:53 am Post subject: |
|
|
Thanks Shawn...I'll give it a try. I'm new to KiXforms and I see lots of advantages with forms within vbScript. Thanks for replying...  |
|
Back to top |
|
 |
CluM09 KiXforms Follower

Joined: 29 May 2007 Posts: 25
|
Posted: Wed Feb 04, 2009 2:38 pm Post subject: |
|
|
Hello,
I have a For..Next loop within the VBscript code to run some task. I like to insert the Execute(Formname.DoEvent) within the loop so that when I click on the button, it will quit the VBScript and close the form.
However, when I insert the Execute(Formname.DoEvent) code within the For...Next Loop, the loop cannot proceed. The loop just hangs at the Execute(Formname.DoEvernt) line indefinitely.
How can I stop break the loop with a button click?
Thanks for any suggestion. |
|
Back to top |
|
 |
|