cancel
Showing results for 
Search instead for 
Did you mean: 

Close Window

Former Member
0 Kudos

Hi, my question is how can I to close a windows "without" close the main window?

I try using  close();, hiding the window, sending the [ESC] key but this close the parent window.

Thanks.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Where you recommend me to catch the active form?

Former Member
0 Kudos

Hi,

It's always better to catch the form open event. There you can identify the form by using the unique pval.FormUID.

Beni.

Former Member
0 Kudos

Hi,

Has your problem solved? Please close the thread.

Beni.

Former Member
0 Kudos

Hi, is SAP Business One 9.0

oForm.Close() give me an error due at I dont know, current thread execution I dont remember the complete error description.

[ESC] close me all windows. I want to close only the windows on focus.

Former Member
0 Kudos

I close the first time the form, work ok.

I open again and close and this says

Form - Invalid Form

COM Error

Former Member
0 Kudos

Hi,

When do you try to close it - in which event?

Can you post your code here (the opening and the closing methods)?

Beni.

Former Member
0 Kudos

I open from a menu


public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            try

            {  

..... some code ....

if (pVal.BeforeAction && pVal.MenuUID == "SubMenu0105")

                {

                    //SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("No implementado",1,"","","");

                    FormHotel formHotel = new FormHotel();

                    formHotel.Show();

                }

... catch finally etc....

I close this windows so:


on init form

Form oForm = null;

        SAPbobsCOM.Company compania = Program.oCompania;

        public FormHotel()

        {

            oForm = SAPbouiCOM.Framework.Application.SBO_Application.Forms.ActiveForm;

     //etc code..        

}

..............

private void Button0_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            oForm.Close();

        }

Former Member
0 Kudos

Hi,

Before you close the window by code, are you sure that the oForm object is referring to the new form opened?

In your constructor, you're catching the active from, but this may happen before your form has initialized and the actual active form is application main window...

Beni.

former_member183246
Participant
0 Kudos

Hi Pablo,

If you want to Close the form you can use the Form object .Close method.

Ex. If oForm is the object of form then,

oForm.Close();

-Regards

Vikas

Former Member
0 Kudos

All SAP forms can close using [ESC] button. What SBO version you are using?

former_member217514
Active Contributor
0 Kudos

What version?

To close a window, you need to call the Close method of the Form instance you want to close.