How to close an infopath form (in a browser) programatically from a button (NOT using RULES)

Scenario: Infopath forms services, moss 2007, theres a button on the form , has some rules which are applied and then i want some code to run (including submit form) - all this works. But how do i get it to close afterwards? All i need is some C# to close form and make sure it returns to back to page form was opened from.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Clay FoxConnect With a Mentor Director of Business IntegrationCommented:
The default is to return to the originating page.

I believe Close() is what you want. Check the MSDN reference.

You could also put the close on the button as a rule, which will execute after the code.
No Close() method can't be referenced(not available) in FormCode.cs???  (NOT using RULES)
All Courses

From novice to tech pro — start learning today.