KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

I want to close a form

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
Frank Bonefont
KiXforms Novice
KiXforms Novice


Joined: 23 Dec 2007
Posts: 3
Location: Riverside, CA

PostPosted: Sun Dec 23, 2007 9:20 am    Post subject: I want to close a form Reply with quote

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... Smile

'~~< 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
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Dec 23, 2007 10:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Frank Bonefont
KiXforms Novice
KiXforms Novice


Joined: 23 Dec 2007
Posts: 3
Location: Riverside, CA

PostPosted: Mon Dec 24, 2007 3:53 am    Post subject: Reply with quote

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... Razz
Back to top
View user's profile Send private message Send e-mail MSN Messenger
CluM09
KiXforms Follower
KiXforms Follower


Joined: 29 May 2007
Posts: 25

PostPosted: Wed Feb 04, 2009 2:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group