Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, August 24, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: How to close a Form
Alan Young
Posts: 17
 
How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Nov 07 8:26 PM
I have a button on a form named btnCancel, and this script is bound to the onClick event
But it does not work , wont close the form.
what is up?

Sub CancelClick(Sender)
'' close current form
Application.BasicFunctions.CloseCurrentView(false)
End Sub

Thanks
Alan Young
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Dec 07 12:06 AM
Today must be the day !

This is a legacy function and should no longer be used, especially when invoking a view as a MainView.

Use frmName.Close

[Reply][Quote]
Alan Young
Posts: 17
 
Re: How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 07 1:22 PM
ok i tried

Contact:MyForm.Close
Contact:MyForm.Close()
Me.Close
Me.Close()

all are not working. I get variable is undefined

What am I missing?

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 07 1:34 PM
What is the name of the form - just omit the contact: bit.
[Reply][Quote]
Alan Young
Posts: 17
 
Re: How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 07 2:19 PM
Ok after much experimentation I came up with the following that works.

Assuming the form.name property is "ContactForm123" then I can call a sub I made named CloseMyForm
That sub goes through the application.forms object and finds my form.
Then it sets modal result= mrCancel.


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CancelClick(Sender)

CloseMyForm("ContactForm123")

End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CloseMyForm(formName)
dim thisviewname
dim thisviewid
dim strthisform

dim i
dim mvcount
dim myformindex
dim myFormCaption
dim MyFormName

myFormName=formName
mvcount=application.Forms.Count
myformindex=-1
for i = 1 to mvcount -1
thisviewname=Application.Forms.Item(i).Name
if trim(thisviewname)=myFormName then
myformindex=i
' msgbox "found my form at " & myformindex & " " & myformname
end if
next

if myformindex > -1 then
'msgbox "Closing form " & myFormName & " at " & myformindex
Application.Forms.Item(myformindex).ModalResult=mrCancel
'''' by the way this does NOT WORK
'''' Application.Forms.Item(myformindex).Close
end if

end Sub

[Reply][Quote]
Konstantin Vishnevsky
Posts: 97
 
Re: How to close a FormYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Jul 08 3:48 PM
It is easier to set frmMyForm.ModalResult to anything but mrNone.
For example [code] frmMyForm.ModalResult = mrCancel[/code]
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/24/2025 11:37:19 AM